public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "mark.plotnick at gmail dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug cli/17349] New: gdb doesn't read symbol table file specified by -symbols (or -s) option Date: Wed, 03 Sep 2014 17:49:00 -0000 [thread overview] Message-ID: <bug-17349-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=17349 Bug ID: 17349 Summary: gdb doesn't read symbol table file specified by -symbols (or -s) option Product: gdb Version: 7.8 Status: NEW Severity: normal Priority: P2 Component: cli Assignee: unassigned at sourceware dot org Reporter: mark.plotnick at gmail dot com gdb (in main.c:captured_main), while processing its command line options, sets symarg to the argument that follows -s, but then later in the code, it unconditionally sets symarg to the executable's name. So the symbol table file the user specified is not read in. This was originally reported by a user on Stack Overflow. http://stackoverflow.com/questions/25625155/why-doesnt-the-gdb-s-option-load-the-symbol-file/ Here's how to reproduce the problem (On Ubuntu 14.04, with gdb 7.7): $ cat ab.c #include <stdlib.h> main() { abort(); } $ cc -g ab.c -o ab $ objcopy --only-keep-debug ab ab.dbg $ objcopy --strip-debug ab $ ./ab Aborted (core dumped) $ gdb -s ./ab.dbg ./ab ./core GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7 Reading symbols from ./ab...(no debugging symbols found)...done. [New LWP 11244] Core was generated by `./ab'. Program terminated with signal SIGABRT, Aborted. #0 0x00007f6488d83bb9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007f6488d83bb9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007f6488d86fc8 in __GI_abort () at abort.c:89 #2 0x0000000000400536 in main () (gdb) symbol-file ./ab.dbg Load new symbol table from "./ab.dbg"? (y or n) y Reading symbols from ./ab.dbg...done. (gdb) bt #0 0x00007f6488d83bb9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007f6488d86fc8 in __GI_abort () at abort.c:89 #2 0x0000000000400536 in main () at ab.c:5 The symbol-file command was required in order to load the symbol table and provide line number info for main(). My try at a minimal fix: A couple ways to fix it. You know best. $ diff -C 1 main.c.orig main.c *** main.c.orig 2014-07-29 08:37:42.000000000 -0400 --- main.c 2014-09-02 16:27:54.079039046 -0400 *************** *** 864,866 **** } ! symarg = argv[optind]; execarg = argv[optind]; --- 864,866 ---- } ! if (symarg == NULL) symarg = argv[optind]; execarg = argv[optind]; *************** *** 877,879 **** { ! symarg = argv[optind]; execarg = argv[optind]; --- 877,879 ---- { ! if (symarg == NULL) symarg = argv[optind]; execarg = argv[optind]; -- You are receiving this mail because: You are on the CC list for the bug.
reply other threads:[~2014-09-03 17:49 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-17349-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).