I am porting gdb for a target that uses the a.out file format. When running the nodebug.exp testsuite, I discovered that gdb is unable to tell which section (text, data, or bss) a given pc belongs to, regardless of whether the file contains debug info or not. After extensive tracing I found only one way to tell gdb where the text section starts in my object file: by changing the value of TEXT_START_ADDR in my tm-file. bfd/PORTING has the following to say: TEXT_START_ADDR The address of the start of the text segemnt in virtual memory. Normally, the same as the entry point. In aout64.h, N_TXTADDR is defined to be TEXT_START_ADDR (because my N_HEADER_IN_TEXT == 0). N_DATADDR and N_BSSADDR are defined as offsets with respect to N_TXTADDR. To me, it seems resonable that gdb should be able to decide the start address of the text segment by looking at the entry point from the aout header, and adjusting its address to the nearest lower page boundary. I reckon the best place for this to happen is in aout-target.h, MY(callback), where the desired information is already at hand -- execp in the code snippet below contains the entry point, as well as the sizes of the three sections. That is all I need. static const bfd_target * MY(callback) (abfd) bfd *abfd; { struct internal_exec *execp = exec_hdr (abfd); unsigned int arch_align_power; unsigned long arch_align; /* Calculate the file positions of the parts of a newly read aout header */ obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp); /* The virtual memory addresses of the sections */ obj_textsec (abfd)->vma = N_TXTADDR(*execp); obj_datasec (abfd)->vma = N_DATADDR(*execp); obj_bsssec (abfd)->vma = N_BSSADDR(*execp); [...] Are there any good reasons for not doing this? I'm willing to implement this change and submit a patch for it, but I would like some feedback on these thoughts. I'm certainly not an expert on headers of a.out files on different systems, but if entry point was missing in the a.out header we could fall back on using TEXT_START_ADDR the way it is done now. My reason for wanting this change is that I don't want to recompile gdb, or have different versions, depending on the object file. As far as I can tell from running the DejaGnu testsuite, it only affects debugging without debug info. Maybe there's a performance issue as well; I think gdb has to dig through the (minimal) symbol tables a whole lot more when it can't easily deduce which section a pc belongs to. -- Orjan Friberg E-mail: [EMAIL PROTECTED] Axis Communications AB Phone: +46 46 272 17 68 _______________________________________________ Bug-gdb mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gdb