Skip to content
Snippets Groups Projects
Commit 687f1075 authored by Vivek Das Mohapatra's avatar Vivek Das Mohapatra
Browse files

capsule-dlmopen.c: when debugging WRAPPERS turn on extra debug for ELF

The code path that installs wrappers inside the capsule is the same
as the one that scribbles capsule functions out into the rest of the
application - however if we don't want to turn on noisy debug in the
ELF handling paths all the time - so we cheat and turn it on around
the ELF munging call from the wrap function only if DEBUG_WRAPPERS
is already in the flags.
parent 96785572
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
......@@ -1353,6 +1353,12 @@ wrap (const char *name,
if( mmap_entry_should_be_writable( &rdata.mmap_info[i] ) )
add_mmap_protection( &rdata.mmap_info[i], PROT_WRITE );
// if we're debugging wrapper installation in detail we
// will end up in a path that's normally only DEBUG_ELF
// debugged:
if( debug_flags & DEBUG_WRAPPERS )
debug_flags = debug_flags | DEBUG_ELF;
// install any required wrappers inside the capsule:
process_pt_dynamic( (void *)start, // offset from phdr to dyn section
size, // fake size value (max possible value)
......@@ -1361,6 +1367,9 @@ wrap (const char *name,
process_dt_rel,
&rdata );
// put the debug flags back in case we changed them
debug_flags = rdata.debug;
// put the mmap()/mprotect() permissions back the way they were:
for( int i = 0; rdata.mmap_info[i].start != MAP_FAILED; i++ )
if( mmap_entry_should_be_writable( &rdata.mmap_info[i] ) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment