This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

errors in GDB reading symbols


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]