LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to get symbol information from .o file using BFD? (https://www.linuxquestions.org/questions/linux-software-2/how-to-get-symbol-information-from-o-file-using-bfd-128864/)

Oxyd 12-25-2003 01:26 PM

How to get symbol information from .o file using BFD?
 
I need to get informations about symbols inside an .o file. So I'm trying it with BFD library (or whatever it is). I have this code:

Code:

#include <iostream>
#include <bfd.h>
using namespace std;

int main ()
{
        bfd *abfd      = 0;


        bfd_init ();

        abfd = bfd_openr ("mdl.o", "elf32-i386");

        if (abfd == 0) {
                cerr << "Can't initialize abfd!\n";
                return 1;
        }

        long needed = bfd_get_symtab_upper_bound (abfd);

        cout << "Needed = " << needed << endl;
}

- It causes segmentation fault error. I don't know why? Btw - I took it from "info bfd" if anyone's interested.

I'm on G++ 3.2.2....

Oxyd.


All times are GMT -5. The time now is 12:38 PM.