This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/RFC] offsets in a.out files [104814]

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

	* exec.c (build_section_table): Set section offsets for aout
	if entry point != 0.

Index: exec.c
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.  */
    return 0;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]