This is the mail archive of the
mailing list for the GDB project.
[RFA/RFC] offsets in a.out files 
- From: Michael Snyder <msnyder at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 24 Oct 2002 15:29:09 -0700
- Subject: [RFA/RFC] offsets in a.out files 
- Organization: Red Hat, Inc.
I bet that subject got everyone's attention, huh? <not>
This is an old patch that I found in Michael Chastain's "to do" directory.
The user has an a.out file that has been linked at an offset, for an
embedded system. The offset appears as a non-zero entry point address
in the a.out header (a_entry).
Michael's fix was to have gdb check for a non-zero entry point,
and to use that to adjust the offsets of the sections. I have
a strong feeling that this is only appropriate to do for a.out,
so I've added a test for that to Michael's original patch.
Does this make sense to folks?
2002-10-24 Michael Snyder <email@example.com>
* exec.c (build_section_table): Set section offsets for aout
if entry point != 0.
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.19
diff -p -r1.19 exec.c
*** exec.c 12 Sep 2002 19:49:56 -0000 1.19
--- exec.c 24 Oct 2002 22:27:14 -0000
*************** build_section_table (bfd *some_bfd, stru
*** 399,404 ****
--- 399,414 ----
bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end);
if (*end > *start + count)
internal_error (__FILE__, __LINE__, "failed internal consistency check");
+ if (bfd_get_flavour (some_bfd) == bfd_target_aout_flavour)
+ bfd_vma start_address;
+ start_address = bfd_get_start_address (some_bfd);
+ if (start_address != 0)
+ exec_set_section_offsets (start_address, start_address, start_address);
/* We could realloc the table, but it probably loses for most files. */