This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug cli/17349] New: gdb doesn't read symbol table file specified by -symbols (or -s) option
- From: "mark.plotnick at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 03 Sep 2014 17:49:50 +0000
- Subject: [Bug cli/17349] New: gdb doesn't read symbol table file specified by -symbols (or -s) option
- Auto-submitted: auto-generated
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.