diff options
author | Michael Snyder <msnyder@vmware.com> | 2010-05-16 00:46:46 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2010-05-16 00:46:46 +0000 |
commit | 5cc80db34dcbe944fe7b480c9841f309c0cf6e96 (patch) | |
tree | 3ee3107bbf08fab571cf8f08c35726b1e9c47dcc /gdb/objfiles.c | |
parent | b8d56208c522b6a27efe7790770ef65a3031da7b (diff) | |
download | gdb-5cc80db34dcbe944fe7b480c9841f309c0cf6e96.zip gdb-5cc80db34dcbe944fe7b480c9841f309c0cf6e96.tar.gz gdb-5cc80db34dcbe944fe7b480c9841f309c0cf6e96.tar.bz2 |
2010-05-15 Michael Snyder <msnyder@vmware.com>
* objc-lang.c: White space.
* objfiles.c: White space.
* observer.c: White space.
* osabi.c: White space.
* osdata.c: White space.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r-- | gdb/objfiles.c | 147 |
1 files changed, 74 insertions, 73 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 9c8dd09..953bc88 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -707,26 +707,26 @@ free_all_objfiles (void) Return non-zero iff any change happened. */ static int -objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets) +objfile_relocate1 (struct objfile *objfile, + struct section_offsets *new_offsets) { struct obj_section *s; struct section_offsets *delta = ((struct section_offsets *) alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections))); - { - int i; - int something_changed = 0; - for (i = 0; i < objfile->num_sections; ++i) - { - delta->offsets[i] = - ANOFFSET (new_offsets, i) - ANOFFSET (objfile->section_offsets, i); - if (ANOFFSET (delta, i) != 0) - something_changed = 1; - } - if (!something_changed) - return 0; - } + int i; + int something_changed = 0; + + for (i = 0; i < objfile->num_sections; ++i) + { + delta->offsets[i] = + ANOFFSET (new_offsets, i) - ANOFFSET (objfile->section_offsets, i); + if (ANOFFSET (delta, i) != 0) + something_changed = 1; + } + if (!something_changed) + return 0; /* OK, get all the symtabs. */ { @@ -794,6 +794,7 @@ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets) { struct minimal_symbol *msym; + ALL_OBJFILE_MSYMBOLS (objfile, msym) if (SYMBOL_SECTION (msym) >= 0) SYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, SYMBOL_SECTION (msym)); @@ -816,6 +817,7 @@ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets) { int i; + for (i = 0; i < objfile->num_sections; ++i) (objfile->section_offsets)->offsets[i] = ANOFFSET (new_offsets, i); } @@ -1009,65 +1011,64 @@ qsort_cmp (const void *a, const void *b) else if (sect1_addr > sect2_addr) return 1; else - { - /* Sections are at the same address. This could happen if - A) we have an objfile and a separate debuginfo. - B) we are confused, and have added sections without proper relocation, - or something like that. */ - - const struct objfile *const objfile1 = sect1->objfile; - const struct objfile *const objfile2 = sect2->objfile; - - if (objfile1->separate_debug_objfile == objfile2 - || objfile2->separate_debug_objfile == objfile1) - { - /* Case A. The ordering doesn't matter: separate debuginfo files - will be filtered out later. */ - - return 0; - } - - /* Case B. Maintain stable sort order, so bugs in GDB are easier to - triage. This section could be slow (since we iterate over all - objfiles in each call to qsort_cmp), but this shouldn't happen - very often (GDB is already in a confused state; one hopes this - doesn't happen at all). If you discover that significant time is - spent in the loops below, do 'set complaints 100' and examine the - resulting complaints. */ - - if (objfile1 == objfile2) - { - /* Both sections came from the same objfile. We are really confused. - Sort on sequence order of sections within the objfile. */ - - const struct obj_section *osect; - - ALL_OBJFILE_OSECTIONS (objfile1, osect) - if (osect == sect1) - return -1; - else if (osect == sect2) - return 1; - - /* We should have found one of the sections before getting here. */ - gdb_assert (0); - } - else - { - /* Sort on sequence number of the objfile in the chain. */ - - const struct objfile *objfile; - - ALL_OBJFILES (objfile) - if (objfile == objfile1) - return -1; - else if (objfile == objfile2) - return 1; - - /* We should have found one of the objfiles before getting here. */ - gdb_assert (0); - } - - } + { + /* Sections are at the same address. This could happen if + A) we have an objfile and a separate debuginfo. + B) we are confused, and have added sections without proper relocation, + or something like that. */ + + const struct objfile *const objfile1 = sect1->objfile; + const struct objfile *const objfile2 = sect2->objfile; + + if (objfile1->separate_debug_objfile == objfile2 + || objfile2->separate_debug_objfile == objfile1) + { + /* Case A. The ordering doesn't matter: separate debuginfo files + will be filtered out later. */ + + return 0; + } + + /* Case B. Maintain stable sort order, so bugs in GDB are easier to + triage. This section could be slow (since we iterate over all + objfiles in each call to qsort_cmp), but this shouldn't happen + very often (GDB is already in a confused state; one hopes this + doesn't happen at all). If you discover that significant time is + spent in the loops below, do 'set complaints 100' and examine the + resulting complaints. */ + + if (objfile1 == objfile2) + { + /* Both sections came from the same objfile. We are really confused. + Sort on sequence order of sections within the objfile. */ + + const struct obj_section *osect; + + ALL_OBJFILE_OSECTIONS (objfile1, osect) + if (osect == sect1) + return -1; + else if (osect == sect2) + return 1; + + /* We should have found one of the sections before getting here. */ + gdb_assert (0); + } + else + { + /* Sort on sequence number of the objfile in the chain. */ + + const struct objfile *objfile; + + ALL_OBJFILES (objfile) + if (objfile == objfile1) + return -1; + else if (objfile == objfile2) + return 1; + + /* We should have found one of the objfiles before getting here. */ + gdb_assert (0); + } + } /* Unreachable. */ gdb_assert (0); |