Description of problem: Running inferior which crashes. Upon reaching the prompt I just type p/x $pc and gdb crashes. Version-Release number of selected component: gdb-7.8.1-32.fc21 Additional info: reporter: libreport-2.3.0 backtrace_rating: 4 cmdline: gdb ./jt3 crash_function: dump_core executable: /usr/bin/gdb kernel: 3.17.4-301.fc21.x86_64 runlevel: N 5 type: CCpp uid: 1000 Truncated backtrace: Thread no. 1 (10 frames) #2 dump_core at ../../gdb/utils.c:612 #3 internal_vproblem at ../../gdb/utils.c:777 #4 internal_verror at ../../gdb/utils.c:803 #5 internal_error at ../../gdb/utils.c:813 #6 value_of_register_lazy at ../../gdb/findvar.c:292 #7 value_of_register at ../../gdb/findvar.c:273 #8 evaluate_subexp_standard at ../../gdb/eval.c:836 #9 evaluate_subexp_c at ../../gdb/c-lang.c:720 #10 evaluate_subexp_standard at ../../gdb/eval.c:2057 #11 evaluate_subexp_c at ../../gdb/c-lang.c:720 Potential duplicate: bug 716627
Created attachment 964916 [details] File: backtrace
Created attachment 964917 [details] File: cgroup
Created attachment 964918 [details] File: core_backtrace
Created attachment 964919 [details] File: dso_list
Created attachment 964920 [details] File: environ
Created attachment 964921 [details] File: limits
Created attachment 964922 [details] File: maps
Created attachment 964923 [details] File: open_fds
Created attachment 964925 [details] File: proc_pid_status
Created attachment 964927 [details] File: var_log_messages
Here is a self-contained reproducer: #include <dlfcn.h> #include <stdlib.h> int main() { system("echo 'int foo() { return foo(); }' | gcc -x c -shared -fpic -o u.so -"); void *d = dlopen("./u.so", RTLD_LAZY); if (d == NULL) { puts(dlerror()); return 1; } unlink("u.so"); int (*fp)(void) = (int(*)(void)) dlsym(d, "foo"); return fp(); } Run this under gdb and then just execute "p $pc". Notice that the program crashes due to a stack overrun. If you have this error in the executable itself it'll work fine. The problem is that the DSO goes away before gdb reads the debug info. This happens, for instance, with gcc's JIT.
For reference, here is the libgccjit RFE for working around this from the jit side: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64206 (so that both bugs link to each other)
(In reply to Dave Malcolm from comment #12) > For reference, here is the libgccjit RFE for working around this from the > jit side: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64206 > (so that both bugs link to each other) FWIW libgccjit attempts to work around this, as of gcc r219395 (2015-01-09).
Another user experienced a similar problem: Downloaded winff sources -> https://winff.googlecode.com/files/WinFF-1.5.2-source.tar.gz -> opened in Lazarus IDE -> tried to compile winff reporter: libreport-2.3.0 backtrace_rating: 4 cmdline: /usr/bin/gdb -silent -i mi -nx crash_function: dump_core executable: /usr/bin/gdb kernel: 3.18.3-201.fc21.x86_64 package: gdb-7.8.2-38.fc21 reason: gdb killed by SIGABRT runlevel: N 5 type: CCpp uid: 1000
[patch] Do not close BFDs, breaking deleted inferior shlibs https://sourceware.org/ml/gdb-patches/2015-02/msg00367.html
Another user experienced a similar problem: I debugged an user-mode-linux executable and i always seem to hit this assertion: The assertion is in: 409│ static int 410│ thread_get_info_callback (const td_thrhandle_t *thp, void *argp) 430│ if (inout->thread_info == NULL) 431│ { 432│ /* New thread. Attach to it now (why wait?). */ 433│ if (!have_threads (thread_ptid)) 434│ thread_db_find_new_threads_1 (thread_ptid); 435│ else 436│ attach_thread (thread_ptid, thp, &ti); 437│ inout->thread_info = find_thread_ptid (thread_ptid); 438├> gdb_assert (inout->thread_info != NULL); 439│ } 440│ 441│ return 0; (gdb) p thread_ptid $3 = {pid = 1454508, lwp = -1, tid = 0} pid 1454508 is the user mode linux kernel exectuable file. (gdb) p *inout $5 = {thread_info = 0x0, thread_db_info = 0x2662eb0} (gdb) p *inout->thread_db_info $7 = {next = 0x0, pid = 1454508, handle = 0x277cd30, filename = 0x0, proc_handle = {ptid = {pid = 1454508, lwp = 1454508, tid = 0}}, thread_agent = 0x264f440, need_stale_parent_threads_check = 0, td_create_bp_addr = 269203038288, td_death_bp_addr = 269203038304, td_init_p = 0x7f50b4f82920 <td_init>, td_ta_new_p = 0x7f50b4f82940 <td_ta_new>, td_ta_map_id2thr_p = 0x7f50b4f82b50 <td_ta_map_id2thr>, td_ta_map_lwp2thr_p = 0x7f50b4f82e50 <td_ta_map_lwp2thr>, td_ta_thr_iter_p = 0x7f50b4f83220 <td_ta_thr_iter>, td_ta_event_addr_p = 0x7f50b4f842d0 <td_ta_event_addr>, td_ta_set_event_p = 0x7f50b4f84a60 <td_ta_set_event>, td_ta_clear_event_p = 0x7f50b4f84f00 <td_ta_clear_event>, td_ta_event_getmsg_p = 0x7f50b4f84c50 <td_ta_event_getmsg>, td_thr_validate_p = 0x7f50b4f83ef0 <td_thr_validate>, td_thr_get_info_p = 0x7f50b4f83520 <td_thr_get_info>, td_thr_event_enable_p = 0x7f50b4f843b0 <td_thr_event_enable>, td_thr_tls_get_addr_p = 0x7f50b4f85220 <td_thr_tls_get_addr>, td_thr_tlsbase_p = 0x7f50b4f85120 <td_thr_tlsbase>} any ideas what is going on here? bug or feature? I can provide more info about the failing gdb using another gdb :-) reporter: libreport-2.3.0 backtrace_rating: 4 cmdline: gdb --nw --annotate=2 -x /home/thomas/.tgdb/a2_gdb_init ./linux crash_function: dump_core executable: /usr/bin/gdb kernel: 4.0.0 package: gdb-7.8.2-38.fc21 reason: gdb killed by SIGABRT runlevel: N 5 type: CCpp uid: 1000
This message is a reminder that Fedora 21 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 21. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '21'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 21 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.