June 2017
Intermediate to advanced
478 pages
13h 14m
English
Here is a sample GDB session looking at a core file:
$ arm-poky-linux-gnueabi-gdb sort-debug /home/chris/rootfs/corefiles/core.sort-debug.1431425613[...]Core was generated by `./sort-debug'.Program terminated with signal SIGSEGV, Segmentation fault.#0 0x000085c8 in addtree (p=0x0, w=0xbeac4c60 "the") at sort-debug.c:4141 p->word = strdup (w);
That shows that the program stopped at line 41. The list command shows the code in the vicinity:
(gdb) list37 static struct tnode *addtree (struct tnode *p, char *w)38 {39 int cond;4041 p->word = strdup (w);42 p->count = 1;43 p->left = NULL;44 p->right = NULL;45
The backtrace command (shortened to bt) shows how we got to this point:
(gdb) bt#0 0x000085c8 in addtree ...
Read now
Unlock full access