Use External Debugging Information
Learn how to use external debugging information.
We'll cover the following...
Application source code
For this lesson, we’ve created two executables from this code: one with the debug information and one in which the debug information has been stripped off.
Press + to interact
// Build:// gcc main.c -g -pthread -static -o App2S#include <stdio.h>#include <pthread.h>#include <unistd.h>#include <string.h>#include <stdlib.h>void procA(){sleep(1);int *p = NULL;*p = 1;}void procB(){sleep(2);void (*pf)() = NULL;pf();}#define THREAD_DECLARE(num,func) void bar_##num() \{ \func; \} \\void foo_##num() \{ \bar_##num(); \} \\void * thread_##num (void *arg) \{ \foo_##num(); \\return 0; \}THREAD_DECLARE(one,sleep(-1))THREAD_DECLARE(two,procA())THREAD_DECLARE(three,sleep(-1))THREAD_DECLARE(four,procB())THREAD_DECLARE(five,sleep(-1))#define THREAD_CREATE(num) {pthread_t threadID_##num; pthread_create (&threadID_##num, NULL, thread_##num, NULL);}int main(int argc, const char * argv[]){THREAD_CREATE(one)THREAD_CREATE(two)THREAD_CREATE(three)THREAD_CREATE(four)THREAD_CREATE(five)sleep(3);return 0;}
Loading the core dump
The first thing we are going to do is load the dump file that we have included with the course.
gdb -c core.App2S -se App2S
The above command will output the ...
Access this course and 1400+ top-rated courses and projects.