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

If a stubroutine in the shim is called dump some backtrace info

We shouldn't ever reach a shim stubroutine, so if we do it means
a relocation has probably failed: We dump a few backtrace frames
if this happens so we can track down which DSO called into the
shim, and hopefully figure out what kind of relocation it was.
parent 7b19760b
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
...@@ -21,15 +21,36 @@ ...@@ -21,15 +21,36 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <execinfo.h>
#include <capsule.h> #include <capsule.h>
#define UNVERSIONED_STUB(name) \ #define UNVERSIONED_STUB(name) \
void name (void) { fprintf(stderr, "! SHIM " #name " called\n" ); return; } void name (void) \
{ \
fprintf(stderr, "! SHIM " #name " called\n" ); \
backtrace_shim_call(); \
return; \
}
#define VERSIONED_STUB(name,version) \ #define VERSIONED_STUB(name,version) \
UNVERSIONED_STUB(name); UNVERSIONED_STUB(name);
void backtrace_shim_call (void)
{
void *trace[16] = { NULL };
int traced = 0;
char **symbols = NULL;
traced = backtrace( trace, sizeof(trace)/sizeof(void *) );
symbols = backtrace_symbols( trace, traced );
for( int x = 1; x < traced; x++ )
fprintf( stderr, " -> %s\n", symbols[x] );
free( symbols );
}
// We don't support versioned symbols properly yet, they need som // We don't support versioned symbols properly yet, they need som
// asm magic that looks like this and I'm not clear on the details: // asm magic that looks like this and I'm not clear on the details:
// __asm__(".symver _" #name "," #name #version) // __asm__(".symver _" #name "," #name #version)
......
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