public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/17349] New: gdb doesn't read symbol table file specified by -symbols (or -s) option
@ 2014-09-03 17:49 mark.plotnick at gmail dot com
0 siblings, 0 replies; only message in thread
From: mark.plotnick at gmail dot com @ 2014-09-03 17:49 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-03 17:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-03 17:49 [Bug cli/17349] New: gdb doesn't read symbol table file specified by -symbols (or -s) option mark.plotnick at gmail dot com
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).