errors in GDB reading symbols

kceiwH kceiwh@gmail.com
Sun Aug 2 23:45:00 GMT 2009


Forget it. I found the bug. I gave a different parameter to my  
program. Sorry to bother you.

Regards,

Mao


On Aug 1, 2009, at 5:38 PM, kceiwH wrote:

> 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
>
>



More information about the Gdb mailing list