Re: Extracting Debug (meta data) from executable images?
Siegfried Heintze wrote: I looked in c:\cygwin\usr\doc\ELFIO and there is a nice PDF file that refers to the examples directory. Where is this examples directory? What is the relationship between stabs and ELF? ELF is a file format for objects and executables that is used on linux and other *nixes. It is not used on windows, which uses PE/coff. Trying to run elfdump on a windows binary will never work. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Extracting Debug (meta data) from executable images?
Siegfried Heintze wrote: Neither nm, readelf or objdump enumerate the fields of a struct. It looks like dwarfdump would, but libdwarf does not compile with cygwin/gcc 3.4 or RedHat8/gcc 3.2. Did you actually try objdump -g like I said? Because as far as I can tell it basically dumps everything that is available in the debug information, which includes structs. // foo.c struct mystruct { int myint; long mylong; float myfloat; }; int main() { struct mystruct x; } $ gcc -g -c foo.c $ objdump -g foo.o foo.o: file format pe-i386 /tmp/debug_test/foo.c: typedef int32 int; typedef int8 char; typedef int32 long int; typedef uint32 unsigned int; typedef uint32 long unsigned int; typedef int64 long long int; typedef uint64 long long unsigned int; typedef int16 short int; typedef uint16 short unsigned int; typedef int8 signed char; typedef uint8 unsigned char; typedef float float; typedef double double; typedef float96 long double; typedef struct %anon1 { /* size 8 */ int real; /* bitsize 32, bitpos 0 */ int imag; /* bitsize 32, bitpos 32 */ } complex int; typedef complex float0 complex float; typedef complex float0 complex double; typedef complex float0 complex long double; typedef void void; typedef char *__builtin_va_list; typedef bool32 boolean; typedef boolean _Bool; struct mystruct { /* size 12 id 2 */ int myint; /* bitsize 32, bitpos 0 */ long int mylong; /* bitsize 32, bitpos 32 */ float myfloat; /* bitsize 32, bitpos 64 */ }; int main () { /* 0x0 */ { /* 0x0 */ struct mystruct /* id 2 */ x /* 0xffe8 */; /* file /tmp/debug_test/foo.c line 9 addr 0x0 */ /* file /tmp/debug_test/foo.c line 9 addr 0x25 */ /* file /tmp/debug_test/foo.c line 11 addr 0x2a */ } /* 0x2c */ } /* 0x2c */ I'm not suggesting that you use objdump, I'm suggesting that you look at it's source code and modify it as necessary because it shares the same code as gdb for reading debug info (the bfd library), without all the extra cruft of gdb. So if I download the source code for GDB, do I compile it on cygwin using g++? You build it like any other program. If you have to ask, though... Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Extracting Debug (meta data) from executable images?
Siegfried Heintze wrote: What is the relationship between cygwin, windows and these formats and libraries? Can I use these linux libraries to read debug information in images created with g++ on cygwin? If not, how do I read the debug information in images created with g++ on cygwin? The gcc / binutils / gdb distributed with Cygwin use stabs. I believe that patches to get dwarf2 working have been submitted, and in theory if you build your own toolchain you should be able to do this. But extracting debug info is way too vague of a term to offer any meaningful help. You'd have to state exactly what you're trying to do. Try man objdump or objdump -g file, or read the binutils/bfd internals manuals. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Extracting Debug (meta data) from executable images?
On Wed, Dec 07, 2005 at 01:18:17PM -0800, Brian Dessent wrote: Siegfried Heintze wrote: What is the relationship between cygwin, windows and these formats and libraries? Can I use these linux libraries to read debug information in images created with g++ on cygwin? If not, how do I read the debug information in images created with g++ on cygwin? The gcc / binutils / gdb distributed with Cygwin use stabs. I believe that patches to get dwarf2 working have been submitted, and in theory if you build your own toolchain you should be able to do this. But extracting debug info is way too vague of a term to offer any meaningful help. You'd have to state exactly what you're trying to do. Try man objdump or objdump -g file, or read the binutils/bfd internals manuals. But despite all of this, I'm sure Igor is still pleased... cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: Extracting Debug (meta data) from executable images?
But extracting debug info is way too vague of a term to offer any meaningful help. You'd have to state exactly what you're trying to do. Try man objdump or objdump -g file, or read the binutils/bfd internals manuals. I basically want to implement reflection for C++ by extracting all the metadata in the debug portion of the executable image to an xml file. Then I can easily write programs that can enumerate all the data members of any given struct or class. GDB can do this: too bad it produces C syntax instead of XML. I don't want to parse C, it is too difficult. I found a utility called gccxml which uses the gcc front end and dumps XML for all the class and struct information. It is strange, however, because it does not implement the -I switch that gcc does. Neither nm, readelf or objdump enumerate the fields of a struct. It looks like dwarfdump would, but libdwarf does not compile with cygwin/gcc 3.4 or RedHat8/gcc 3.2. So if I download the source code for GDB, do I compile it on cygwin using g++? I'd just need to modify the info variables and ptype commands to emit XML instead of C. Siegfried -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: Extracting Debug (meta data) from executable images?
How does ELFDump.exe work? I did a chmod 777 hello.* and still ELFDump hello.o And ELFDump hello.exe Still produce the Can't openinput file Hello.exe Thanks, Siegfried -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/