core-file

understanding stack trace of a segmentation fault

余生长醉 提交于 2021-01-27 05:34:32
问题 I am doing an snprintf and getting a seg fault. when I loaded the core file on gdb like this: gdb my_executable core ; and did bt to get the backtrace, I got following: Program terminated with signal 11, Segmentation fault. #0 0x88207fc2 in memcpy () from /usr/lib/libc.so.6 (gdb) bt #0 0x88207fc2 in memcpy () from /usr/lib/libc.so.6 #1 0x88205eb6 in __sfvwrite () from /usr/lib/libc.so.6 #2 0x881fbc95 in strchr () from /usr/lib/libc.so.6 #3 0xbfbe6c14 in ?? () #4 0xbfbe69d8 in ?? () #5

Saving core file in gdb

ε祈祈猫儿з 提交于 2019-12-20 08:09:33
问题 Is it possible to save/dump core file using gdb? Sometimes I want to save file to analyze it later. 回答1: Issue the 'generate-core-file' command in gdb. (gdb) help generate-core-file Save a core file with the current state of the debugged process. Argument is optional filename. Default filename is 'core.<process_id>'. (gdb) break main Breakpoint 1 at 0x400e0b: file utils/udec.c, line 36. (gdb) r Starting program: /home/nos/build/utils/udec Breakpoint 1, main (argc=1, argv=0x7fffffffe9a8) at

Return a value via a gdb user-defined command

烂漫一生 提交于 2019-12-12 11:00:04
问题 I'm debugging with a core-file, so I have no active process in which to run anything. I'm using gdb user-defined commands to inspect a bunch of data from the core file, and attempting to simplify the process using user-defined commands. However, I cannot find a way to make the user-defined commands return values which could be used in other commands. For example: (note the comment on the "return" line) define dump_linked_list set $node = global_list->head set $count = 1 while $node != 0

gdb won't read core file from foreign architecture

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 10:39:11
问题 I'm trying to read an ARM core file on my Linux desktop, but it seems not to be able to figure out my core file. Is there any way I can instruct gdb what type my core file is? $ file ~/daemon ./daemon: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.0.0, not stripped $ file ~/core ./core: ELF 32-bit LSB core file ARM, version 1 (SYSV), SVR4-style, from './daemon -v -v -v -v -e 10 -t foo' $ gdb-multiarch ~/daemon ~/core GNU gdb (GDB) 7.5-ubuntu

Saving core file in gdb

本小妞迷上赌 提交于 2019-12-02 14:25:34
Is it possible to save/dump core file using gdb? Sometimes I want to save file to analyze it later. Issue the 'generate-core-file' command in gdb. (gdb) help generate-core-file Save a core file with the current state of the debugged process. Argument is optional filename. Default filename is 'core.<process_id>'. (gdb) break main Breakpoint 1 at 0x400e0b: file utils/udec.c, line 36. (gdb) r Starting program: /home/nos/build/utils/udec Breakpoint 1, main (argc=1, argv=0x7fffffffe9a8) at utils/udec.c:36 36 int fileargc = 1; (gdb) generate-core-file Saved corefile core.7336 You can also use gcore