aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile-mem.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2014-04-02 09:54:11 +0200
committerMarkus Metzger <markus.t.metzger@intel.com>2014-05-23 09:12:24 +0200
commit589fdceb99db9868e34bc976b7e234dbfaf327e2 (patch)
treec19c9ca529e3a2bf3ed0df2a2e948dd77009926c /gdb/symfile-mem.c
parente9089e05b6a1a89ba6b8f3123f9d76bf066e3db7 (diff)
downloadgdb-589fdceb99db9868e34bc976b7e234dbfaf327e2.zip
gdb-589fdceb99db9868e34bc976b7e234dbfaf327e2.tar.gz
gdb-589fdceb99db9868e34bc976b7e234dbfaf327e2.tar.bz2
btrace, vdso: add vdso target sections
When loading symbols for the vdso, also add its sections to target_sections. This fixes an issue with record btrace where vdso instructions could not be disassembled during replay. * symfile-mem.c (symbol_file_add_from_memory): Add BFD sections. testsuite/ * gdb.btrace/vdso.c: New. * gdb.btrace/vdso.exp: New.
Diffstat (limited to 'gdb/symfile-mem.c')
-rw-r--r--gdb/symfile-mem.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 3f09c4d..b29421e 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -92,6 +92,7 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
struct section_addr_info *sai;
unsigned int i;
struct cleanup *cleanup;
+ struct target_section *sections, *sections_end, *tsec;
if (bfd_get_flavour (templ) != bfd_target_elf_flavour)
error (_("add-symbol-file-from-memory not supported for this target"));
@@ -131,6 +132,23 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
from_tty ? SYMFILE_VERBOSE : 0,
sai, OBJF_SHARED, NULL);
+ sections = NULL;
+ sections_end = NULL;
+
+ if (build_section_table (nbfd, &sections, &sections_end) == 0)
+ {
+ make_cleanup (xfree, sections);
+
+ /* Adjust the target section addresses by the load address. */
+ for (tsec = sections; tsec != sections_end; ++tsec)
+ {
+ tsec->addr += loadbase;
+ tsec->endaddr += loadbase;
+ }
+
+ add_target_sections (&nbfd, sections, sections_end);
+ }
+
/* This might change our ideas about frames already looked at. */
reinit_frame_cache ();