Archive for the ‘Linux’ Category

11/20: How to debug a segfault from dmesg log

LinuxShawnNo Comments

When presented with a segfault like this:

segfault at 0 ip b7a64b57 sp bf8fda58 error 4
in libc-2.9.so[b79f1000+13f000]

tl;dr

Problem happened within libc-2.9.so at 0x73b57 in the function strncmp because of a user-mode read access error trying to access 0x0 (NULL)

Read the rest of this entry »

10/1: Who is Calling Whom?

C, LinuxShawnNo Comments

Have you ever wanted to know which function is calling a specific function. This snippet will help in digging up those pesky dependencies at runtime.

#include < stdio.h >
 
// Fn Function
void Fn( char* val )
{
  printf("Ahoy World! %s\n", val);
}
 
// Debug Call Conversion
#define Fn(...) \
  printf( "%s:%d %s()\n",__FILE__, __LINE__, __FUNCTION__); \
  Fn(__VA_ARGS__)
 
//Main
int main( void )
{
  Fn("Arrr!");
  return 0;
}

Read the rest of this entry »