From: kceiwH <kceiwh@gmail.com>
To: gdb@sourceware.org
Subject: errors in GDB reading symbols
Date: Sat, 01 Aug 2009 21:38:00 -0000 [thread overview]
Message-ID: <97234C41-9CA5-4A2C-89BA-6B54256D8B81@gmail.com> (raw)
Hi,
I try to write a program to convert a line number of the source code
to the corresponding memory address. The program will link to libgdb,
libbfd, libiberty, libopcodes, which are generated when you compile
GDB. My problem is that the number of symbols (more than ten thousand)
of a given executable file that my program reads is quite different
from that (less than one hundred) GDB reads.
All I did is mainly calling the interfaces to read an executable file
and its symbols. That is, I call exec_file_attach and
symbol_file_add_main. They should read the file's symbols.
My last try is copying the codes from functions main (in gdb/gdb.c),
gdb_main (in gdb/main.c), and captured_main (in gdb/main.c), without
the statement captured_command_loop, and putting them in a single
function in my program. I also changed the names of some local
variables, so I don't need to pass them as parameters. And the paths
such as BINDIR, DEBUGDIR, gdb_sysroot are set to the current directory
".". Even though, the program still reads more than ten thousand
symbols of a given executable file.
I compile my program with linking to libgdb, libbfd, libopcodes,
libiberty. And I also compiled GDB and run it to test whether my
program behaved correctly. They are based on the same codes. The only
differences are the path names. So my program should behave like GDB.
But my program reads much more symbols than the GDB does. Is there
anybody knows why that happen. I appreciate if you can give a clue.
Regards,
Mao
next reply other threads:[~2009-08-01 21:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-01 21:38 kceiwH [this message]
2009-08-02 23:45 ` kceiwH
2009-08-03 16:53 ` Tom Tromey
2009-08-03 17:01 ` Daniel Jacobowitz
2009-08-03 20:47 ` Baurzhan Ismagulov
2009-08-04 14:33 ` Tom Tromey
2009-08-04 14:46 ` Daniel Jacobowitz
2009-08-04 14:47 ` Daniel Jacobowitz
2009-08-04 14:52 ` Jonas Maebe
2009-08-04 14:55 ` Daniel Jacobowitz
2009-08-06 17:09 ` Tom Tromey
2009-08-06 21:00 ` Jonas Maebe
2009-08-07 16:24 ` Daniel Jacobowitz
2009-08-07 20:48 Marco van de Voort
2009-08-11 21:00 ` Tom Tromey
2009-08-12 0:56 ` Paul Pluzhnikov
2009-08-21 17:33 ` Tom Tromey
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=97234C41-9CA5-4A2C-89BA-6B54256D8B81@gmail.com \
--to=kceiwh@gmail.com \
--cc=gdb@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: link
Be 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