diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-02-01 19:27:55 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-02-01 19:27:55 +0000 |
commit | b381ea14bd6aa64d0412c4207658f545a9331965 (patch) | |
tree | 019072fe15774d2288971e18690778a7e65204ed /gdb/solib-svr4.c | |
parent | c593ac0e2369c486dc92648bdb0ed266e9d7271b (diff) | |
download | gdb-b381ea14bd6aa64d0412c4207658f545a9331965.zip gdb-b381ea14bd6aa64d0412c4207658f545a9331965.tar.gz gdb-b381ea14bd6aa64d0412c4207658f545a9331965.tar.bz2 |
gdb/
* solib-svr4.c (scan_dyntag): New variable dyn_addr. Replace gdb_assert
by a conditional setting DYN_ADDR. Use DYN_ADDR.
* config/djgpp/fnchange.lst: Add translations for
symbol-without-target_section.exp and symbol-without-target_section.c.
gdb/testsuite/
* gdb.base/symbol-without-target_section.exp,
gdb.base/symbol-without-target_section.c: New.
Diffstat (limited to 'gdb/solib-svr4.c')
-rw-r--r-- | gdb/solib-svr4.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index e497364..5689bf3 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -570,7 +570,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr) { int arch_size, step, sect_size; long dyn_tag; - CORE_ADDR dyn_ptr; + CORE_ADDR dyn_ptr, dyn_addr; gdb_byte *bufend, *bufstart, *buf; Elf32_External_Dyn *x_dynp_32; Elf64_External_Dyn *x_dynp_64; @@ -597,7 +597,17 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr) target_section++) if (sect == target_section->the_bfd_section) break; - gdb_assert (target_section < current_target_sections->sections_end); + if (target_section < current_target_sections->sections_end) + dyn_addr = target_section->addr; + else + { + /* ABFD may come from OBJFILE acting only as a symbol file without being + loaded into the target (see add_symbol_file_command). This case is + such fallback to the file VMA address without the possibility of + having the section relocated to its actual in-memory address. */ + + dyn_addr = bfd_section_vma (abfd, sect); + } /* Read in .dynamic from the BFD. We will get the actual value from memory later. */ @@ -639,7 +649,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr) CORE_ADDR ptr_addr; ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; - ptr_addr = target_section->addr + (buf - bufstart) + arch_size / 8; + ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8; if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0) dyn_ptr = extract_typed_address (ptr_buf, ptr_type); *ptr = dyn_ptr; |