public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] aristovski/validate-binary-before-use: Tests for validate symbol file using build-id.
@ 2013-04-16 13:19 aristovski
0 siblings, 0 replies; 2+ messages in thread
From: aristovski @ 2013-04-16 13:19 UTC (permalink / raw)
To: archer-commits
The branch, aristovski/validate-binary-before-use has been updated
discards f3af537c2c4595df30f2ef1d60706b51c6a9df11 (commit)
discards a93c3646c09eb1125cb5070b8bad42dad5f8b07e (commit)
discards 659ff615c91a714fbe4f56068955c40bdf7234a8 (commit)
discards 1e324e602f9679cf00ac82306bdc0dd4de4611e0 (commit)
discards 6c805422d1704fee8bb033cb5b26a343ba7a60e9 (commit)
discards 504aa1b8c2b181a4d4deb6542961c804966d1775 (commit)
discards 34358983877ff06af9dba085317072896836351c (commit)
discards 37c064593ba6d72b03b3589fab66816a0b792999 (commit)
discards 20be147335c0ee6e21230c934ec790cf5380cfcb (commit)
via 298921b071404e2f5ed21184fe8a8f8b55cbcc5f (commit)
via c85cc58af91177b6fee9e56bd58c30280d88a581 (commit)
via 90e5ca4da95bf8e7a9888dd4ee66c9f9ef3242a8 (commit)
via 9923a243a7d47715778b7aabec420a273fcc880d (commit)
via 9156b67d1f394a904737c304c106730ea4005e38 (commit)
via f3f4f26ac1cbd9405807d5e9d4fb26f65a27d520 (commit)
via 5f2fbbb9aef6c57311872673c1b86af0c8e8ee5e (commit)
via 4e6ba4862e4190be9ec6a92447d11a7b2c7c0a9e (commit)
via f6c8560c008449b811612a2c1560069102f50684 (commit)
via 92687545f1f26e54b40d90812b34791d97ecd867 (commit)
via 20cf09b42ad2bcb0225cdc36cb228e515bd510a7 (commit)
via 766ce5943c7dd9484310bd71a91a8b19d5b7b5c2 (commit)
via 972f1ca0327da78f0eb9cd7fe9a760696642dc75 (commit)
via cb22b288a796779e3238ff812226a9897854c5aa (commit)
via 049dc1118adce445d49828154b415f963c41a4d5 (commit)
from f3af537c2c4595df30f2ef1d60706b51c6a9df11 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 298921b071404e2f5ed21184fe8a8f8b55cbcc5f
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 16:06:26 2013 -0400
Tests for validate symbol file using build-id.
* gdb.base/solib-mismatch-lib.c: New file.
* gdb.base/solib-mismatch-libmod.c: New file.
* gdb.base/solib-mismatch.c: New file.
* gdb.base/solib-mismatch.exp: New file.
commit c85cc58af91177b6fee9e56bd58c30280d88a581
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 16:05:19 2013 -0400
Validate symbol file using build-id.
* solib-darwin.c (_initialize_darwin_solib): Assign validate value.
* solib-dsbt.c (_initialize_dsbt_solib): Ditto.
* solib-frv.c (_initialize_frv_solib): Ditto.
* solib-ia64-hpux.c (ia64_hpux_target_so_ops): Ditto.
* solib-irix.c (_initialize_irix_solib): Ditto.
* solib-osf.c (_initialize_osf_solib): Ditto.
* solib-pa64.c (_initialize_pa64_solib): Ditto.
* solib-som.c (_initialize_som_solib): Ditto.
* solib-spu.c (set_spu_solib_ops): Ditto.
* solib-sunos.c (_initialize_sunos_solib): Ditto.
* solib-svr4.c (NOTE_GNU_BUILD_ID_NAME): New define.
(svr4_validate): New function.
(library_list_start_library): Parse 'build-id' attribute.
(svr4_library_attributes): Add 'build-id' attribute.
(_initialize_svr4_solib): Assign validate value.
* solib-target.c (solib.h): Include.
(_initialize_solib_target): Assign validate value.
* solib.c (solib_map_sections): Use ops->validate.
(free_so): Free build_id.
(solib_validate): New function.
* solib.h (solib_validate): New declaration.
* solist.h (so_list): New fields 'build_idsz' and 'build_id'.
(target_so_ops): New field 'validate'.
commit 90e5ca4da95bf8e7a9888dd4ee66c9f9ef3242a8
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 11:56:57 2013 -0400
gdbserver build-id attribute generator
* doc/gdb.texinfo (Library List Format for SVR4 Targets): Add
'build-id' in description, example, new attribute in dtd.
* features/library-list-svr4.dtd (library-list-svr4): New
'build-id' attribute.
* linux-low.c (linux-maps.h, search.h): Include.
(ElfXX_Ehdr, ElfXX_Phdr, ElfXX_Nhdr): New.
(ELFXX_FLD, ELFXX_SIZEOF, ELFXX_ROUNDUP, BUILD_ID_INVALID): New.
(find_phdr): New.
(get_dynamic): Use find_pdhr to traverse program headers.
(struct mapping_entry): New structure.
(mapping_entry_s): New typedef, new vector type def.
(free_mapping_entry, compare_mapping_entry,
compare_mapping_entry_range, compare_mapping_entry_inode): New.
(struct find_memory_region_callback_data): New.
(find_memory_region_callback): New fwd. declaration.
(read_build_id, find_memory_region_callback, get_hex_build_id): New.
(linux_qxfer_libraries_svr4): Add optional build-id attribute
to reply XML document.
commit 9923a243a7d47715778b7aabec420a273fcc880d
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:54:36 2013 -0400
Move linux_find_memory_regions_full & co.
* common/common-target.c (gdb_assert.h, gdb_string.h): Include.
(read_alloc, read_stralloc): Move definitions from target.c.
* common/common-target.h (read_alloc_pread_ftype): New typedef.
(read_alloc): New declaration.
(read_stralloc_func_ftype): New typedef.
(read_stralloc): New declaration.
* common/linux-maps.c (fcntl.h, unistd.h, target.h, gdb_assert.h,
ctype.h, string.h, common-target.h): Include.
(read_mapping): Move from linux-tdep.c.
(linux_find_memory_read_stralloc_1_pread): New function.
(linux_find_memory_read_stralloc_1): New function.
(linux_find_memory_read_stralloc): New function.
* common/linux-maps.h (read_mapping): New declaration.
(linux_find_memory_region_ftype): Moved typedef from linux-tdep.c.
(linux_find_memory_regions_full): New declaration.
* linux-tdep.c (linux-maps.h): Include.
(read_mapping): Moved to common/linux-maps.c.
(linux_find_memory_region_ftype): Moved typedef to common/linux-maps.h.
(linux_find_memory_regions_full): Moved definition to
common/linux-maps.c.
* target.c (common-target.h): Include.
(read_alloc_pread_ftype): Moved typedef to common/common-target.h.
(read_alloc, read_stralloc): Moved definitions to
common/common-target.c.
commit 9156b67d1f394a904737c304c106730ea4005e38
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:49:36 2013 -0400
Prepare linux_find_memory_regions_full & co. for move
* linux-tdep.c (linux_find_memory_region_ftype): Comment.
(linux_find_memory_regions_full): Change signature and prepare
for moving to linux-maps.
(linux_find_memory_regions_data): Rename field 'obfd' to 'data'.
(linux_find_memory_regions_thunk): New.
(linux_find_memory_regions_thunk): Use 'data' field instead of 'obfd'.
(linux_find_memory_regions_gdb): New.
(linux_find_memory_regions): Rename argument 'obfd' to 'func_data'.
(linux_make_mappings_corefile_notes): Use
linux_find_memory_regions_gdb.
* target.c (read_alloc_pread_ftype): New typedef.
(target_fileio_read_alloc_1_pread): New function.
(read_alloc): Refactor from target_fileio_read_alloc_1.
(read_stralloc_func_ftype): New typedef.
(target_fileio_read_alloc_1): New implementation. Use read_alloc.
(read_stralloc): Refactored from target_fileio_read_stralloc.
(target_fileio_read_stralloc): New implementation, use read_stralloc.
commit f3f4f26ac1cbd9405807d5e9d4fb26f65a27d520
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:40:24 2013 -0400
Create empty common/linux-maps.[ch] and common/common-target.[ch]
* Makefile.in (HFILES_NO_SRCDIR); Add common/linux-maps.h,
common/common-target.h.
(COMMON_OBS): Add common-target.o.
(linux-maps.o, common-target.o): New.
* common/common-target.c: New file.
* common/common-target.h: New file.
* common/linux-maps.c: New file.
* common/linux-maps.h: New file.
* config/i386/linux.mh (NATDEPFILES): Add linux-maps.o.
* config/i386/linux64.mh (NATDEPFILES): Ditto.
* gdbserver/Makefile.in (OBS): Add common-taret.o.
(linux-maps.o, common-target.o): New.
* gdbserver/configure.srv (srv_tgtobj): Add linux-maps.o.
commit 5f2fbbb9aef6c57311872673c1b86af0c8e8ee5e
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:39:05 2013 -0400
Merge multiple hex conversions
* common/common-utils.c (fromhex): Make externally linkable.
Change error message.
(tohex): Make externally linkable.
* common/common-utils.h (fromhex, tohex): New declaration.
* gdbserver/gdbreplay.c (tohex): Rename to 'fromhex'.
(logchar): Use fromhex.
* gdbserver/remote-utils.c (fromhex, unhexify): Remove.
(tohex, hexify): Remove.
(look_up_one_symbol, monitor_output): Use bin2hex instead of hexify.
* gdbserver/server.c (handle_query): Use bin2hex instead of hexify.
(handle_v_run): Ditto.
* gdbserver/server.h (unhexify, hexify): Remove declarations.
* gdbserver/tracepoint.c (cmd_qtdpsrc, cmd_qtdv): Use hex2bin
instead of unhexify.
(cmd_qtstatus): Use bin2hex instead of hexify.
(cmd_qtnotes): Use hex2bin instead of unhexify.
* monitor.c (fromhex): Remove definition.
* remote.c (tohex, fromhex): Remove fwd declarations, remove
definitions.
commit 4e6ba4862e4190be9ec6a92447d11a7b2c7c0a9e
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:39:05 2013 -0400
Move utility functions to common/
* cli/cli-utils.c (skip_spaces, skip_spaces_const): Move defs to
common/common-utils.c.
* cli/cli-utils.h (skip_spaces, skip_spaces_const): Move decls to
common/common-utils.h.
* common/common-utils.c (ctype.h): Include.
(HIGH_BYTE_POSN, is_digit_in_base, digit_to_int, strtoulst): Move
from utils.c.
(fromhex): Copy from remote.c.
(hex2bin): Move from remote.c.
(tohex): Copy from remote.c.
(bin2hex): Move from remote.c.
(skip_spaces, skip_spaces_const): Move from cli/cli-utils.c.
* common/common-utils.h (TARGET_CHAR_BIT, HOST_CHAR_BIT): Moved
from defs.h.
(strtoulst): Move decl from utils.h.
(hex2bin, bin2hex): Move decls from remote.h.
(skip_spaces, skip_spaces_const): Move decls from cli/cli-utils.h.
* defs.h (TARGET_CHAR_BIT, HOST_CHAR_BIT): Move to
common/common-utils.h
* remote.c (hex2bin, bin2hex): Moved defs to common/common-utils.c.
* remote.h (hex2bin, bin2hex): Moved decls to common/common-utils.h.
* utils.c (HIGH_BYTE_POSN, is_digit_in_base, digit_to_int,
strtoulst): Move to common/common-utils.c.
* utils.h (strtoulst): Moved decl to common/common-utils.h.
commit f6c8560c008449b811612a2c1560069102f50684
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Apr 10 14:01:34 2013 -0400
Add README.archer
commit 92687545f1f26e54b40d90812b34791d97ecd867
Author: gdbadmin <gdbadmin@sourceware.org>
Date: Tue Apr 16 00:00:32 2013 +0000
*** empty log message ***
commit 20cf09b42ad2bcb0225cdc36cb228e515bd510a7
Author: Alan Modra <amodra@bigpond.net.au>
Date: Tue Apr 16 00:00:04 2013 +0000
daily update
commit 766ce5943c7dd9484310bd71a91a8b19d5b7b5c2
Author: Doug Evans <dje@google.com>
Date: Mon Apr 15 23:53:37 2013 +0000
* dwarf2read.c (struct dwo_file): Replace member "cus" with "cu".
(struct create_dwo_cu_data): Renamed from create_dwo_info_table_data.
(create_dwo_cu_reader): Renamed from
create_dwo_debug_info_hash_table_reader.
(create_dwo_cu): Renamed from create_dwo_debug_info_hash_table.
Remove support for multiple CUs in a DWO file.
(open_and_init_dwo_file, lookup_dwo_cutu): Update.
commit 972f1ca0327da78f0eb9cd7fe9a760696642dc75
Author: Doug Evans <dje@google.com>
Date: Mon Apr 15 22:14:40 2013 +0000
* dwarf2read.c (create_debug_types_hash_table): Use hex_string
instead of phex.
(lookup_dwo_unit, create_dwo_debug_info_hash_table_reader): Ditto.
(create_dwo_in_dwp): Ditto.
commit cb22b288a796779e3238ff812226a9897854c5aa
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Apr 15 21:16:17 2013 +0000
Check regular reference without non-GOT reference
non_got_ref may not be set when building shared library. We need to set
non_got_ref if there are any non-PIC relocations. But we only did this
when there were no PLT/GOT relocations. It failed when there is a PLT
relocation. This checkin moves the non_got_ref check out.
bfd/
2013-04-15 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15371
* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Check
regular reference without non-GOT reference when building
shared library.
ld/testsuite/
2013-04-15 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15371
* ld-ifunc/ifunc-20-i386.d: New file.
* ld-ifunc/ifunc-20-x86-64.d: Likewise.
* ld-ifunc/ifunc-20.s: Likewise.
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
index e56427d..7e7ec36 100644
--- a/bfd/elf-ifunc.c
+++ b/bfd/elf-ifunc.c
@@ -187,23 +187,20 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
htab = elf_hash_table (info);
+ /* When building shared library, we need to handle the case where it is
+ marked with regular reference, but not non-GOT reference since the
+ non-GOT reference bit may not be set here. */
+ if (info->shared && !h->non_got_ref && h->ref_regular)
+ for (p = *head; p != NULL; p = p->next)
+ if (p->count)
+ {
+ h->non_got_ref = 1;
+ goto keep;
+ }
+
/* Support garbage collection against STT_GNU_IFUNC symbols. */
if (h->plt.refcount <= 0 && h->got.refcount <= 0)
{
- /* When building shared library, we need to handle the case
- where it is marked with regular reference, but not non-GOT
- reference. It may happen if we didn't see STT_GNU_IFUNC
- symbol at the time when checking relocations. */
- if (info->shared
- && !h->non_got_ref
- && h->ref_regular)
- for (p = *head; p != NULL; p = p->next)
- if (p->count)
- {
- h->non_got_ref = 1;
- goto keep;
- }
-
h->got = htab->init_got_offset;
h->plt = htab->init_plt_offset;
*head = NULL;
diff --git a/ld/testsuite/ld-ifunc/ifunc-20-i386.d b/ld/testsuite/ld-ifunc/ifunc-20-i386.d
new file mode 100644
index 0000000..9373fcf
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-20-i386.d
@@ -0,0 +1,13 @@
+#source: ifunc-20.s
+#ld: -shared -m elf_i386 -z nocombreloc
+#as: --32
+#readelf: -r --wide
+#target: x86_64-*-* i?86-*-*
+
+Relocation section '.rel.ifunc' at offset 0x[0-9a-f]+ contains 1 entries:
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_32[ ]+ifunc\(\)[ ]+ifunc
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_JUMP_SLOT[ ]+ifunc\(\)[ ]+ifunc
diff --git a/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
new file mode 100644
index 0000000..39492d4
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
@@ -0,0 +1,13 @@
+#source: ifunc-20.s
+#ld: -shared -m elf_x86_64 -z nocombreloc
+#as: --64
+#readelf: -r --wide
+#target: x86_64-*-*
+
+Relocation section '.rela.ifunc' at offset 0x[0-9a-f]+ contains 1 entries:
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_64[ ]+ifunc\(\)[ ]+ifunc \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_JUMP_SLOT[ ]+ifunc\(\)[ ]+ifunc \+ 0
diff --git a/ld/testsuite/ld-ifunc/ifunc-20.s b/ld/testsuite/ld-ifunc/ifunc-20.s
new file mode 100644
index 0000000..9d45455
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-20.s
@@ -0,0 +1,16 @@
+ .section .data.rel,"aw",@progbits
+ .globl ifunc_ptrt
+ .type ifunc_ptr, @object
+ifunc_ptr:
+ .dc.a ifunc
+ .text
+ .type ifunc, @gnu_indirect_function
+ .globl ifunc
+ifunc:
+ ret
+ .size ifunc, .-ifunc
+ .type bar, @function
+ .globl bar
+bar:
+ call ifunc@PLT
+ .size bar, .-bar
commit 049dc1118adce445d49828154b415f963c41a4d5
Author: sivachandra <sivachandra>
Date: Mon Apr 15 20:37:36 2013 +0000
2013-04-15 Siva Chandra Reddy <sivachandra@google.com>
Add option to link testcases with Pthreads library when
using 'prepare_for_testing' in tests.
testsuite/
* lib/gdb.exp (build_executable_from_specs): Use
gdb_compile_pthreads to compile if option "pthreads" is
specified.
-----------------------------------------------------------------------
Summary of changes:
bfd/ChangeLog | 7 ++
bfd/elf-ifunc.c | 25 +++----
bfd/version.h | 2 +-
gdb/ChangeLog | 15 ++++
gdb/dwarf2read.c | 160 +++++++++++++++++++++++----------------------
gdb/gdbserver/linux-low.c | 123 +++++++++++++++--------------------
gdb/testsuite/ChangeLog | 9 +++
gdb/testsuite/lib/gdb.exp | 20 ++++--
gdb/version.in | 2 +-
9 files changed, 195 insertions(+), 168 deletions(-)
First 500 lines of diff:
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e717f12..883c4a2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2013-04-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/15371
+ * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Check
+ regular reference without non-GOT reference when building
+ shared library.
+
2013-04-15 Alan Modra <amodra@gmail.com>
* archive.c (_bfd_archive_close_and_cleanup): Clear parent
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
index e56427d..7e7ec36 100644
--- a/bfd/elf-ifunc.c
+++ b/bfd/elf-ifunc.c
@@ -187,23 +187,20 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
htab = elf_hash_table (info);
+ /* When building shared library, we need to handle the case where it is
+ marked with regular reference, but not non-GOT reference since the
+ non-GOT reference bit may not be set here. */
+ if (info->shared && !h->non_got_ref && h->ref_regular)
+ for (p = *head; p != NULL; p = p->next)
+ if (p->count)
+ {
+ h->non_got_ref = 1;
+ goto keep;
+ }
+
/* Support garbage collection against STT_GNU_IFUNC symbols. */
if (h->plt.refcount <= 0 && h->got.refcount <= 0)
{
- /* When building shared library, we need to handle the case
- where it is marked with regular reference, but not non-GOT
- reference. It may happen if we didn't see STT_GNU_IFUNC
- symbol at the time when checking relocations. */
- if (info->shared
- && !h->non_got_ref
- && h->ref_regular)
- for (p = *head; p != NULL; p = p->next)
- if (p->count)
- {
- h->non_got_ref = 1;
- goto keep;
- }
-
h->got = htab->init_got_offset;
h->plt = htab->init_plt_offset;
*head = NULL;
diff --git a/bfd/version.h b/bfd/version.h
index a62bb74..f564488 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,4 +1,4 @@
-#define BFD_VERSION_DATE 20130415
+#define BFD_VERSION_DATE 20130416
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f36f87c..2595f8d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,18 @@
+2013-04-15 Doug Evans <dje@google.com>
+
+ * dwarf2read.c (struct dwo_file): Replace member "cus" with "cu".
+ (struct create_dwo_cu_data): Renamed from create_dwo_info_table_data.
+ (create_dwo_cu_reader): Renamed from
+ create_dwo_debug_info_hash_table_reader.
+ (create_dwo_cu): Renamed from create_dwo_debug_info_hash_table.
+ Remove support for multiple CUs in a DWO file.
+ (open_and_init_dwo_file, lookup_dwo_cutu): Update.
+
+ * dwarf2read.c (create_debug_types_hash_table): Use hex_string
+ instead of phex.
+ (lookup_dwo_unit, create_dwo_debug_info_hash_table_reader): Ditto.
+ (create_dwo_in_dwp): Ditto.
+
2013-04-15 Tom Tromey <tromey@redhat.com>
* NEWS: Move recent entries into "since 7.6" section.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8947f8f..0542bea 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -742,9 +742,12 @@ struct dwo_file
/* Section info for this file. */
struct dwo_sections sections;
- /* Table of CUs in the file.
- Each element is a struct dwo_unit. */
- htab_t cus;
+ /* The CU in the file.
+ We only support one because having more than one requires hacking the
+ dwo_name of each to match, which is highly unlikely to happen.
+ Doing this means all TUs can share comp_dir: We also assume that
+ DW_AT_comp_dir across all TUs in a DWO file will be identical. */
+ struct dwo_unit *cu;
/* Table of TUs in the file.
Each element is a struct dwo_unit. */
@@ -4317,16 +4320,16 @@ create_debug_types_hash_table (struct dwo_file *dwo_file,
complaint (&symfile_complaints,
_("debug type entry at offset 0x%x is duplicate to"
- " the entry at offset 0x%x, signature 0x%s"),
+ " the entry at offset 0x%x, signature %s"),
offset.sect_off, dup_offset.sect_off,
- phex (signature, sizeof (signature)));
+ hex_string (signature));
}
*slot = dwo_file ? (void *) dwo_tu : (void *) sig_type;
if (dwarf2_read_debug)
- fprintf_unfiltered (gdb_stdlog, " offset 0x%x, signature 0x%s\n",
+ fprintf_unfiltered (gdb_stdlog, " offset 0x%x, signature %s\n",
offset.sect_off,
- phex (signature, sizeof (signature)));
+ hex_string (signature));
info_ptr += length;
}
@@ -4634,8 +4637,7 @@ lookup_dwo_unit (struct dwarf2_per_cu_data *this_cu,
{
error (_("Dwarf Error: CU at offset 0x%x references unknown DWO"
" with ID %s [in module %s]"),
- this_cu->offset.sect_off,
- phex (signature, sizeof (signature)),
+ this_cu->offset.sect_off, hex_string (signature),
this_cu->objfile->name);
}
@@ -8389,85 +8391,64 @@ allocate_dwo_unit_table (struct objfile *objfile)
/* Structure used to pass data to create_dwo_debug_info_hash_table_reader. */
-struct create_dwo_info_table_data
+struct create_dwo_cu_data
{
struct dwo_file *dwo_file;
- htab_t cu_htab;
+ struct dwo_unit dwo_unit;
};
-/* die_reader_func for create_dwo_debug_info_hash_table. */
+/* die_reader_func for create_dwo_cu. */
static void
-create_dwo_debug_info_hash_table_reader (const struct die_reader_specs *reader,
- const gdb_byte *info_ptr,
- struct die_info *comp_unit_die,
- int has_children,
- void *datap)
+create_dwo_cu_reader (const struct die_reader_specs *reader,
+ const gdb_byte *info_ptr,
+ struct die_info *comp_unit_die,
+ int has_children,
+ void *datap)
{
struct dwarf2_cu *cu = reader->cu;
struct objfile *objfile = dwarf2_per_objfile->objfile;
sect_offset offset = cu->per_cu->offset;
struct dwarf2_section_info *section = cu->per_cu->section;
- struct create_dwo_info_table_data *data = datap;
+ struct create_dwo_cu_data *data = datap;
struct dwo_file *dwo_file = data->dwo_file;
- htab_t cu_htab = data->cu_htab;
- void **slot;
+ struct dwo_unit *dwo_unit = &data->dwo_unit;
struct attribute *attr;
- struct dwo_unit *dwo_unit;
attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
if (attr == NULL)
{
- error (_("Dwarf Error: debug entry at offset 0x%x is missing"
- " its dwo_id [in module %s]"),
- offset.sect_off, dwo_file->dwo_name);
+ complaint (&symfile_complaints,
+ _("Dwarf Error: debug entry at offset 0x%x is missing"
+ " its dwo_id [in module %s]"),
+ offset.sect_off, dwo_file->dwo_name);
return;
}
- dwo_unit = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct dwo_unit);
dwo_unit->dwo_file = dwo_file;
dwo_unit->signature = DW_UNSND (attr);
dwo_unit->section = section;
dwo_unit->offset = offset;
dwo_unit->length = cu->per_cu->length;
- slot = htab_find_slot (cu_htab, dwo_unit, INSERT);
- gdb_assert (slot != NULL);
- if (*slot != NULL)
- {
- const struct dwo_unit *dup_dwo_unit = *slot;
-
- complaint (&symfile_complaints,
- _("debug entry at offset 0x%x is duplicate to the entry at"
- " offset 0x%x, dwo_id 0x%s [in module %s]"),
- offset.sect_off, dup_dwo_unit->offset.sect_off,
- phex (dwo_unit->signature, sizeof (dwo_unit->signature)),
- dwo_file->dwo_name);
- }
- else
- *slot = dwo_unit;
-
if (dwarf2_read_debug)
- fprintf_unfiltered (gdb_stdlog, " offset 0x%x, dwo_id 0x%s\n",
- offset.sect_off,
- phex (dwo_unit->signature,
- sizeof (dwo_unit->signature)));
+ fprintf_unfiltered (gdb_stdlog, " offset 0x%x, dwo_id %s\n",
+ offset.sect_off, hex_string (dwo_unit->signature));
}
-/* Create a hash table to map DWO IDs to their CU entry in
- .debug_info.dwo in DWO_FILE.
- Note: This function processes DWO files only, not DWP files.
- Note: A DWO file generally contains one CU, but we don't assume this. */
+/* Create the dwo_unit for the lone CU in DWO_FILE.
+ Note: This function processes DWO files only, not DWP files. */
-static htab_t
-create_dwo_debug_info_hash_table (struct dwo_file *dwo_file)
+static struct dwo_unit *
+create_dwo_cu (struct dwo_file *dwo_file)
{
struct objfile *objfile = dwarf2_per_objfile->objfile;
struct dwarf2_section_info *section = &dwo_file->sections.info;
bfd *abfd;
htab_t cu_htab;
const gdb_byte *info_ptr, *end_ptr;
- struct create_dwo_info_table_data create_dwo_info_table_data;
+ struct create_dwo_cu_data create_dwo_cu_data;
+ struct dwo_unit *dwo_unit;
dwarf2_read_section (objfile, section);
info_ptr = section->buffer;
@@ -8480,19 +8461,22 @@ create_dwo_debug_info_hash_table (struct dwo_file *dwo_file)
abfd = section->asection->owner;
if (dwarf2_read_debug)
- fprintf_unfiltered (gdb_stdlog, "Reading .debug_info.dwo for %s:\n",
- bfd_get_filename (abfd));
-
- cu_htab = allocate_dwo_unit_table (objfile);
+ {
+ fprintf_unfiltered (gdb_stdlog, "Reading %s for %s:\n",
+ bfd_section_name (abfd, section->asection),
+ bfd_get_filename (abfd));
+ }
- create_dwo_info_table_data.dwo_file = dwo_file;
- create_dwo_info_table_data.cu_htab = cu_htab;
+ create_dwo_cu_data.dwo_file = dwo_file;
+ dwo_unit = NULL;
end_ptr = info_ptr + section->size;
while (info_ptr < end_ptr)
{
struct dwarf2_per_cu_data per_cu;
+ memset (&create_dwo_cu_data.dwo_unit, 0,
+ sizeof (create_dwo_cu_data.dwo_unit));
memset (&per_cu, 0, sizeof (per_cu));
per_cu.objfile = objfile;
per_cu.is_debug_types = 0;
@@ -8502,13 +8486,30 @@ create_dwo_debug_info_hash_table (struct dwo_file *dwo_file)
init_cutu_and_read_dies_no_follow (&per_cu,
&dwo_file->sections.abbrev,
dwo_file,
- create_dwo_debug_info_hash_table_reader,
- &create_dwo_info_table_data);
+ create_dwo_cu_reader,
+ &create_dwo_cu_data);
+
+ if (create_dwo_cu_data.dwo_unit.dwo_file != NULL)
+ {
+ /* If we've already found one, complain. We only support one
+ because having more than one requires hacking the dwo_name of
+ each to match, which is highly unlikely to happen. */
+ if (dwo_unit != NULL)
+ {
+ complaint (&symfile_complaints,
+ _("Multiple CUs in DWO file %s [in module %s]"),
+ dwo_file->dwo_name, objfile->name);
+ break;
+ }
+
+ dwo_unit = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct dwo_unit);
+ *dwo_unit = create_dwo_cu_data.dwo_unit;
+ }
info_ptr += per_cu.length;
}
- return cu_htab;
+ return dwo_unit;
}
/* DWP file .debug_{cu,tu}_index section format:
@@ -8734,9 +8735,9 @@ create_dwo_in_dwp (struct dwp_file *dwp_file,
if (dwarf2_read_debug)
{
- fprintf_unfiltered (gdb_stdlog, "Reading %s %u/0x%s in DWP file: %s\n",
+ fprintf_unfiltered (gdb_stdlog, "Reading %s %u/%s in DWP file: %s\n",
kind,
- section_index, phex (signature, sizeof (signature)),
+ section_index, hex_string (signature),
dwp_file->name);
}
@@ -9059,7 +9060,7 @@ dwarf2_locate_dwo_sections (bfd *abfd, asection *sectp, void *dwo_sections_ptr)
}
/* Initialize the use of the DWO file specified by DWO_NAME and referenced
- by PER_CU.
+ by PER_CU. This is for the non-DWP case.
The result is NULL if DWO_NAME can't be found. */
static struct dwo_file *
@@ -9087,7 +9088,7 @@ open_and_init_dwo_file (struct dwarf2_per_cu_data *per_cu,
bfd_map_over_sections (dbfd, dwarf2_locate_dwo_sections, &dwo_file->sections);
- dwo_file->cus = create_dwo_debug_info_hash_table (dwo_file);
+ dwo_file->cu = create_dwo_cu (dwo_file);
dwo_file->tus = create_debug_types_hash_table (dwo_file,
dwo_file->sections.types);
@@ -9318,26 +9319,31 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
if (dwo_file != NULL)
{
- htab_t htab = is_debug_types ? dwo_file->tus : dwo_file->cus;
+ struct dwo_unit *dwo_cutu = NULL;
- if (htab != NULL)
+ if (is_debug_types && dwo_file->tus)
{
- struct dwo_unit find_dwo_cutu, *dwo_cutu;
+ struct dwo_unit find_dwo_cutu;
memset (&find_dwo_cutu, 0, sizeof (find_dwo_cutu));
find_dwo_cutu.signature = signature;
- dwo_cutu = htab_find (htab, &find_dwo_cutu);
+ dwo_cutu = htab_find (dwo_file->tus, &find_dwo_cutu);
+ }
+ else if (!is_debug_types && dwo_file->cu)
+ {
+ if (signature == dwo_file->cu->signature)
+ dwo_cutu = dwo_file->cu;
+ }
- if (dwo_cutu != NULL)
+ if (dwo_cutu != NULL)
+ {
+ if (dwarf2_read_debug)
{
- if (dwarf2_read_debug)
- {
- fprintf_unfiltered (gdb_stdlog, "DWO %s %s(%s) found: @%s\n",
- kind, dwo_name, hex_string (signature),
- host_address_to_string (dwo_cutu));
- }
- return dwo_cutu;
+ fprintf_unfiltered (gdb_stdlog, "DWO %s %s(%s) found: @%s\n",
+ kind, dwo_name, hex_string (signature),
+ host_address_to_string (dwo_cutu));
}
+ return dwo_cutu;
}
}
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 8d8ba17..eac5318 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -5462,9 +5462,7 @@ get_phdr_phnum_from_proc_auxv (const int pid, const int is_elf64,
return 0;
}
-/* Linearly traverse pheaders given in PHDR until supplied
- predicate function returns 1. If supplied predicate function
- did return 1, stop traversal and return that PHDR. */
+/* Linearly traverse pheaders and look for P_TYPE pheader. */
static const void *
find_phdr (const int is_elf64, const void *const phdr_begin,
@@ -5475,9 +5473,6 @@ find_phdr (const int is_elf64, const void *const phdr_begin,
const ElfXX_Phdr *phdr = phdr_begin;
- if (phdr == NULL)
- return NULL;
-
while (PHDR_NEXT (phdr) <= phdr_end)
{
if (ELFXX_FLD (is_elf64, *phdr, p_type) == p_type)
@@ -5497,8 +5492,8 @@ get_dynamic (const int pid, const int is_elf64)
CORE_ADDR phdr_memaddr, relocation;
int num_phdr;
unsigned char *phdr_buf;
- const int phdr_size = is_elf64 ? sizeof (Elf64_Phdr) : sizeof (Elf32_Phdr);
- const void *phdr;
+ const ElfXX_Phdr *phdr;
+ const int phdr_size = ELFXX_SIZEOF (is_elf64, *phdr);
if (get_phdr_phnum_from_proc_auxv (pid, is_elf64, &phdr_memaddr, &num_phdr))
return 0;
@@ -5515,21 +5510,7 @@ get_dynamic (const int pid, const int is_elf64)
phdr = find_phdr (is_elf64, phdr_buf, phdr_buf + num_phdr * phdr_size,
PT_PHDR);
if (phdr != NULL)
- {
- if (is_elf64)
- {
- const Elf64_Phdr *const p = phdr;
-
- relocation = phdr_memaddr - p->p_vaddr;
- }
- else
- {
- const Elf32_Phdr *const p = phdr;
-
- relocation = phdr_memaddr - p->p_vaddr;
- }
- }
-
+ relocation = phdr_memaddr - ELFXX_FLD (is_elf64, *phdr, p_vaddr);
if (relocation == -1)
{
/* PT_PHDR is optional, but necessary for PIE in general. Fortunately
@@ -5549,20 +5530,7 @@ get_dynamic (const int pid, const int is_elf64)
PT_DYNAMIC);
if (phdr != NULL)
- {
- if (is_elf64)
- {
- const Elf64_Phdr *const p = phdr;
-
- return p->p_vaddr + relocation;
- }
- else
- {
- const Elf32_Phdr *const p = phdr;
-
- return p->p_vaddr + relocation;
- }
- }
+ return ELFXX_FLD (is_elf64, *phdr, p_vaddr) + relocation;
return 0;
}
@@ -5725,8 +5693,10 @@ typedef struct mapping_entry mapping_entry_s;
DEF_VEC_O(mapping_entry_s);
+/* Free vector of mapping_entry_s objects. */
+
static void
-free_mapping_entry (VEC (mapping_entry_s) *lst)
+free_mapping_entry_vec (VEC (mapping_entry_s) *lst)
{
int ix;
mapping_entry_s *p;
@@ -5743,7 +5713,7 @@ free_mapping_entry (VEC (mapping_entry_s) *lst)
static int
compare_mapping_entry_range (const void *const k, const void *const b)
{
- const ULONGEST key = *(CORE_ADDR*) k;
+ const ULONGEST key = *(CORE_ADDR *) k;
const mapping_entry_s *const p = b;
if (key < p->vaddr)
@@ -5759,14 +5729,14 @@ struct find_memory_region_callback_data
{
unsigned is_elf64;
- /* Return. Ordered list of all object mappings sorted in
- ascending order by VADDR. Must be freed with free_mapping_entry. */
+ /* Return. Must be freed with free_mapping_entry_vec. */
VEC (mapping_entry_s) *list;
};
-static linux_find_memory_region_ftype find_memory_region_callback;
-
-/* Read build-id from PT_NOTE. */
+/* Read build-id from PT_NOTE.
+ Argument LOAD_ADDR pepresents run time virtual address corresponding to
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [SCM] aristovski/validate-binary-before-use: Tests for validate symbol file using build-id.
@ 2013-04-15 19:52 aristovski
0 siblings, 0 replies; 2+ messages in thread
From: aristovski @ 2013-04-15 19:52 UTC (permalink / raw)
To: archer-commits
The branch, aristovski/validate-binary-before-use has been updated
discards 97a555f232b050adcd9d5b95822ac9b1b6d2755b (commit)
discards 2bc7d2c57118746ed6a39d1b9abd340c326feaea (commit)
discards 464bc79d0727d6586751b06e801fe8f7e22d6420 (commit)
discards 0febecc57688434f71eed77c143c12e40e662310 (commit)
discards 645577d52a6b417fc896ce6a3cc957cb1d2838e3 (commit)
discards 6a5bda01e48d53498996569c29aca6b03d6cc4cb (commit)
discards 519392ea6261576ec0a773476810c83c30342b6f (commit)
discards b06e48effcf38bd0320f2cf7aada3a397fc6d8e9 (commit)
discards 3e1d712e728f05ab5b24a436b56bf560676b6c2c (commit)
discards 9603e65c7b5db16b8de8f8b37143583b841ab8b6 (commit)
discards 15a4db3d330067154d600a761536748340dc4992 (commit)
discards f9849003625ecaf3184ffef90b7b7ed72b9fec53 (commit)
discards d1950f293fe19ed8ea0c14a4ae572550acff6572 (commit)
discards d5bc0dfb8f8b60cfde5399c2e45c44ac99294bd9 (commit)
discards 121df26f54673b3a458b54f8ab07349fe93a2fb4 (commit)
discards 66064332170a9bee5920dcd3df581b01874c511b (commit)
discards 008039efa87adf141a4c9910be0346e19d85f078 (commit)
discards aa1c4aede2eed583de3f4107da8572c0313fc979 (commit)
discards 18b7ee9185d275e77961e73fada55f0c7ee1de55 (commit)
via f3af537c2c4595df30f2ef1d60706b51c6a9df11 (commit)
via a93c3646c09eb1125cb5070b8bad42dad5f8b07e (commit)
via 659ff615c91a714fbe4f56068955c40bdf7234a8 (commit)
via 1e324e602f9679cf00ac82306bdc0dd4de4611e0 (commit)
via 6c805422d1704fee8bb033cb5b26a343ba7a60e9 (commit)
via 504aa1b8c2b181a4d4deb6542961c804966d1775 (commit)
via 34358983877ff06af9dba085317072896836351c (commit)
via 37c064593ba6d72b03b3589fab66816a0b792999 (commit)
via 20be147335c0ee6e21230c934ec790cf5380cfcb (commit)
from 97a555f232b050adcd9d5b95822ac9b1b6d2755b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit f3af537c2c4595df30f2ef1d60706b51c6a9df11
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 16:06:26 2013 -0400
Tests for validate symbol file using build-id.
* gdb.base/solib-mismatch-lib.c: New file.
* gdb.base/solib-mismatch-libmod.c: New file.
* gdb.base/solib-mismatch.c: New file.
* gdb.base/solib-mismatch.exp: New file.
commit a93c3646c09eb1125cb5070b8bad42dad5f8b07e
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 16:05:19 2013 -0400
Validate symbol file using build-id.
* solib-darwin.c (_initialize_darwin_solib): Assign validate value.
* solib-dsbt.c (_initialize_dsbt_solib): Ditto.
* solib-frv.c (_initialize_frv_solib): Ditto.
* solib-ia64-hpux.c (ia64_hpux_target_so_ops): Ditto.
* solib-irix.c (_initialize_irix_solib): Ditto.
* solib-osf.c (_initialize_osf_solib): Ditto.
* solib-pa64.c (_initialize_pa64_solib): Ditto.
* solib-som.c (_initialize_som_solib): Ditto.
* solib-spu.c (set_spu_solib_ops): Ditto.
* solib-sunos.c (_initialize_sunos_solib): Ditto.
* solib-svr4.c (NOTE_GNU_BUILD_ID_NAME): New define.
(svr4_validate): New function.
(library_list_start_library): Parse 'build-id' attribute.
(svr4_library_attributes): Add 'build-id' attribute.
(_initialize_svr4_solib): Assign validate value.
* solib-target.c (solib.h): Include.
(_initialize_solib_target): Assign validate value.
* solib.c (solib_map_sections): Use ops->validate.
(free_so): Free build_id.
(solib_validate): New function.
* solib.h (solib_validate): New declaration.
* solist.h (so_list): New fields 'build_idsz' and 'build_id'.
(target_so_ops): New field 'validate'.
commit 659ff615c91a714fbe4f56068955c40bdf7234a8
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 11:56:57 2013 -0400
gdbserver build-id attribute generator
* doc/gdb.texinfo (Library List Format for SVR4 Targets): Add
'build-id' in description, example, new attribute in dtd.
* features/library-list-svr4.dtd (library-list-svr4): New
'build-id' attribute.
* linux-low.c (linux-maps.h, search.h): Include.
(ElfXX_Ehdr, ElfXX_Phdr, ElfXX_Nhdr): New.
(ELFXX_FLD, ELFXX_SIZEOF, ELFXX_ROUNDUP, BUILD_ID_INVALID): New.
(find_phdr): New.
(get_dynamic): Use find_pdhr to traverse program headers.
(struct mapping_entry): New structure.
(mapping_entry_s): New typedef, new vector type def.
(free_mapping_entry, compare_mapping_entry,
compare_mapping_entry_range, compare_mapping_entry_inode): New.
(struct find_memory_region_callback_data): New.
(find_memory_region_callback): New fwd. declaration.
(read_build_id, find_memory_region_callback, get_hex_build_id): New.
(linux_qxfer_libraries_svr4): Add optional build-id attribute
to reply XML document.
commit 1e324e602f9679cf00ac82306bdc0dd4de4611e0
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:54:36 2013 -0400
Move linux_find_memory_regions_full & co.
* common/common-target.c (gdb_assert.h, gdb_string.h): Include.
(read_alloc, read_stralloc): Move definitions from target.c.
* common/common-target.h (read_alloc_pread_ftype): New typedef.
(read_alloc): New declaration.
(read_stralloc_func_ftype): New typedef.
(read_stralloc): New declaration.
* common/linux-maps.c (fcntl.h, unistd.h, target.h, gdb_assert.h,
ctype.h, string.h, common-target.h): Include.
(read_mapping): Move from linux-tdep.c.
(linux_find_memory_read_stralloc_1_pread): New function.
(linux_find_memory_read_stralloc_1): New function.
(linux_find_memory_read_stralloc): New function.
* common/linux-maps.h (read_mapping): New declaration.
(linux_find_memory_region_ftype): Moved typedef from linux-tdep.c.
(linux_find_memory_regions_full): New declaration.
* linux-tdep.c (linux-maps.h): Include.
(read_mapping): Moved to common/linux-maps.c.
(linux_find_memory_region_ftype): Moved typedef to common/linux-maps.h.
(linux_find_memory_regions_full): Moved definition to
common/linux-maps.c.
* target.c (common-target.h): Include.
(read_alloc_pread_ftype): Moved typedef to common/common-target.h.
(read_alloc, read_stralloc): Moved definitions to
common/common-target.c.
commit 6c805422d1704fee8bb033cb5b26a343ba7a60e9
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:49:36 2013 -0400
Prepare linux_find_memory_regions_full & co. for move
* linux-tdep.c (linux_find_memory_region_ftype): Comment.
(linux_find_memory_regions_full): Change signature and prepare
for moving to linux-maps.
(linux_find_memory_regions_data): Rename field 'obfd' to 'data'.
(linux_find_memory_regions_thunk): New.
(linux_find_memory_regions_thunk): Use 'data' field instead of 'obfd'.
(linux_find_memory_regions_gdb): New.
(linux_find_memory_regions): Rename argument 'obfd' to 'func_data'.
(linux_make_mappings_corefile_notes): Use
linux_find_memory_regions_gdb.
* target.c (read_alloc_pread_ftype): New typedef.
(target_fileio_read_alloc_1_pread): New function.
(read_alloc): Refactor from target_fileio_read_alloc_1.
(read_stralloc_func_ftype): New typedef.
(target_fileio_read_alloc_1): New implementation. Use read_alloc.
(read_stralloc): Refactored from target_fileio_read_stralloc.
(target_fileio_read_stralloc): New implementation, use read_stralloc.
commit 504aa1b8c2b181a4d4deb6542961c804966d1775
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:40:24 2013 -0400
Create empty common/linux-maps.[ch] and common/common-target.[ch]
* Makefile.in (HFILES_NO_SRCDIR); Add common/linux-maps.h,
common/common-target.h.
(COMMON_OBS): Add common-target.o.
(linux-maps.o, common-target.o): New.
* common/common-target.c: New file.
* common/common-target.h: New file.
* common/linux-maps.c: New file.
* common/linux-maps.h: New file.
* config/i386/linux.mh (NATDEPFILES): Add linux-maps.o.
* config/i386/linux64.mh (NATDEPFILES): Ditto.
* gdbserver/Makefile.in (OBS): Add common-taret.o.
(linux-maps.o, common-target.o): New.
* gdbserver/configure.srv (srv_tgtobj): Add linux-maps.o.
commit 34358983877ff06af9dba085317072896836351c
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:39:05 2013 -0400
Merge multiple hex conversions
* common/common-utils.c (fromhex): Make externally linkable.
Change error message.
(tohex): Make externally linkable.
* common/common-utils.h (fromhex, tohex): New declaration.
* gdbserver/gdbreplay.c (tohex): Rename to 'fromhex'.
(logchar): Use fromhex.
* gdbserver/remote-utils.c (fromhex, unhexify): Remove.
(tohex, hexify): Remove.
(look_up_one_symbol, monitor_output): Use bin2hex instead of hexify.
* gdbserver/server.c (handle_query): Use bin2hex instead of hexify.
(handle_v_run): Ditto.
* gdbserver/server.h (unhexify, hexify): Remove declarations.
* gdbserver/tracepoint.c (cmd_qtdpsrc, cmd_qtdv): Use hex2bin
instead of unhexify.
(cmd_qtstatus): Use bin2hex instead of hexify.
(cmd_qtnotes): Use hex2bin instead of unhexify.
* monitor.c (fromhex): Remove definition.
* remote.c (tohex, fromhex): Remove fwd declarations, remove
definitions.
commit 37c064593ba6d72b03b3589fab66816a0b792999
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Mar 27 09:39:05 2013 -0400
Move utility functions to common/
* cli/cli-utils.c (skip_spaces, skip_spaces_const): Move defs to
common/common-utils.c.
* cli/cli-utils.h (skip_spaces, skip_spaces_const): Move decls to
common/common-utils.h.
* common/common-utils.c (ctype.h): Include.
(HIGH_BYTE_POSN, is_digit_in_base, digit_to_int, strtoulst): Move
from utils.c.
(fromhex): Copy from remote.c.
(hex2bin): Move from remote.c.
(tohex): Copy from remote.c.
(bin2hex): Move from remote.c.
(skip_spaces, skip_spaces_const): Move from cli/cli-utils.c.
* common/common-utils.h (TARGET_CHAR_BIT, HOST_CHAR_BIT): Moved
from defs.h.
(strtoulst): Move decl from utils.h.
(hex2bin, bin2hex): Move decls from remote.h.
(skip_spaces, skip_spaces_const): Move decls from cli/cli-utils.h.
* defs.h (TARGET_CHAR_BIT, HOST_CHAR_BIT): Move to
common/common-utils.h
* remote.c (hex2bin, bin2hex): Moved defs to common/common-utils.c.
* remote.h (hex2bin, bin2hex): Moved decls to common/common-utils.h.
* utils.c (HIGH_BYTE_POSN, is_digit_in_base, digit_to_int,
strtoulst): Move to common/common-utils.c.
* utils.h (strtoulst): Moved decl to common/common-utils.h.
commit 20be147335c0ee6e21230c934ec790cf5380cfcb
Author: Aleksandar Ristovski <ARistovski@qnx.com>
Date: Wed Apr 10 14:01:34 2013 -0400
Add README.archer
-----------------------------------------------------------------------
Summary of changes:
gdb/common/common-target.c | 1 -
gdb/common/common-target.h | 1 -
gdb/common/linux-maps.c | 36 +++++++++-----
gdb/gdbserver/linux-low.c | 72 ++++++++++++++++-------------
gdb/solib-svr4.c | 25 ++++++----
gdb/solib.c | 6 --
gdb/target.c | 10 ++++
gdb/testsuite/gdb.base/solib-mismatch.c | 42 ++++++-----------
gdb/testsuite/gdb.base/solib-mismatch.exp | 69 +++++++++++++++------------
9 files changed, 140 insertions(+), 122 deletions(-)
First 500 lines of diff:
diff --git a/gdb/common/common-target.c b/gdb/common/common-target.c
index d0b3138..907f95c 100644
--- a/gdb/common/common-target.c
+++ b/gdb/common/common-target.c
@@ -113,4 +113,3 @@ read_stralloc (const char *filename, read_stralloc_func_ftype *func)
return bufstr;
}
-
diff --git a/gdb/common/common-target.h b/gdb/common/common-target.h
index 21f21ef..b252c00 100644
--- a/gdb/common/common-target.h
+++ b/gdb/common/common-target.h
@@ -32,4 +32,3 @@ extern char *read_stralloc (const char *filename,
read_stralloc_func_ftype *func);
#endif /* COMMON_COMMON_TARGET_H */
-
diff --git a/gdb/common/linux-maps.c b/gdb/common/linux-maps.c
index 3fcd316..6432b8f 100644
--- a/gdb/common/linux-maps.c
+++ b/gdb/common/linux-maps.c
@@ -126,16 +126,16 @@ int
linux_find_memory_regions_full (pid_t pid, linux_find_memory_region_ftype *func,
void *func_data, void **memory_to_free_ptr)
{
- char filename[100];
+ char mapsfilename[100];
char *data;
- xsnprintf (filename, sizeof filename, "/proc/%d/smaps", (int) pid);
- data = linux_find_memory_read_stralloc (filename);
+ xsnprintf (mapsfilename, sizeof mapsfilename, "/proc/%d/smaps", (int) pid);
+ data = linux_find_memory_read_stralloc (mapsfilename);
if (data == NULL)
{
/* Older Linux kernels did not support /proc/PID/smaps. */
- xsnprintf (filename, sizeof filename, "/proc/%d/maps", (int) pid);
- data = linux_find_memory_read_stralloc (filename);
+ xsnprintf (mapsfilename, sizeof mapsfilename, "/proc/%d/maps", (int) pid);
+ data = linux_find_memory_read_stralloc (mapsfilename);
}
if (data)
{
@@ -171,20 +171,30 @@ linux_find_memory_regions_full (pid_t pid, linux_find_memory_region_ftype *func,
line = strtok (NULL, "\n"))
{
char keyword[64 + 1];
- unsigned long number;
- if (sscanf (line, "%64s%lu kB\n", keyword, &number) != 2)
+ if (sscanf (line, "%64s", keyword) != 1)
{
- warning (_("Error parsing {s,}maps file '%s'"), filename);
+ warning (_("Error parsing {s,}maps file '%s'"), mapsfilename);
break;
}
if (strcmp (keyword, "Anonymous:") == 0)
has_anonymous = 1;
- if (number != 0 && (strcmp (keyword, "Shared_Dirty:") == 0
- || strcmp (keyword, "Private_Dirty:") == 0
- || strcmp (keyword, "Swap:") == 0
- || strcmp (keyword, "Anonymous:") == 0))
- modified = 1;
+ if (strcmp (keyword, "Shared_Dirty:") == 0
+ || strcmp (keyword, "Private_Dirty:") == 0
+ || strcmp (keyword, "Swap:") == 0
+ || strcmp (keyword, "Anonymous:") == 0)
+ {
+ unsigned long number;
+
+ if (sscanf (line, "%*s%lu", &number) != 1)
+ {
+ warning (_("Error parsing {s,}maps file '%s' number"),
+ mapsfilename);
+ break;
+ }
+ if (number != 0)
+ modified = 1;
+ }
}
/* Older Linux kernels did not support the "Anonymous:" counter.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index d819b21..8d8ba17 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -138,13 +138,14 @@ typedef union ElfXX_Nhdr
Elf64_Nhdr _64;
} ElfXX_Nhdr;
-#define ELFXX_FLD(hdr, fld) ((is_elf64) ? (hdr)._64.fld : (hdr)._32.fld)
-#define ELFXX_SIZEOF(hdr) ((is_elf64) ? sizeof ((hdr)._64) \
- : sizeof ((hdr)._32))
-#define ELFXX_ROUNDUP(what) ((is_elf64) ? (((what) + sizeof (Elf64_Word) - 1) \
- & ~(sizeof (Elf64_Word) - 1)) \
- : (((what) + sizeof (Elf32_Word) - 1) \
- & ~(sizeof (Elf32_Word) - 1)))
+#define ELFXX_FLD(elf64, hdr, fld) ((elf64) ? (hdr)._64.fld : (hdr)._32.fld)
+#define ELFXX_SIZEOF(elf64, hdr) ((elf64) ? sizeof ((hdr)._64) \
+ : sizeof ((hdr)._32))
+/* Round up to next 4 byte boundary. */
+#define ELFXX_ROUNDUP_4(elf64, what) ((elf64) ? (((what) + 3) \
+ & ~((Elf64_Word)3U)) \
+ : (((what) + 3) \
+ & ~((Elf32_Word) 3U)))
#define BUILD_ID_INVALID "?"
/* ``all_threads'' is keyed by the LWP ID, which we use as the GDB protocol
@@ -5470,7 +5471,7 @@ find_phdr (const int is_elf64, const void *const phdr_begin,
const void *const phdr_end, const ULONGEST p_type)
{
#define PHDR_NEXT(hdrp) ((const void *) ((const gdb_byte *) (hdrp) + \
- ELFXX_SIZEOF (*hdrp)))
+ ELFXX_SIZEOF (is_elf64, *hdrp)))
const ElfXX_Phdr *phdr = phdr_begin;
@@ -5479,7 +5480,7 @@ find_phdr (const int is_elf64, const void *const phdr_begin,
while (PHDR_NEXT (phdr) <= phdr_end)
{
- if (ELFXX_FLD (*phdr, p_type) == p_type)
+ if (ELFXX_FLD (is_elf64, *phdr, p_type) == p_type)
return phdr;
phdr = PHDR_NEXT (phdr);
}
@@ -5776,22 +5777,24 @@ read_build_id (struct find_memory_region_callback_data *const p,
ElfXX_Ehdr ehdr;
if (linux_read_memory (load_addr, (unsigned char *) &ehdr,
- ELFXX_SIZEOF (ehdr)) == 0
- && ELFXX_FLD (ehdr, e_ident[EI_MAG0]) == ELFMAG0
- && ELFXX_FLD (ehdr, e_ident[EI_MAG1]) == ELFMAG1
- && ELFXX_FLD (ehdr, e_ident[EI_MAG2]) == ELFMAG2
- && ELFXX_FLD (ehdr, e_ident[EI_MAG3]) == ELFMAG3)
+ ELFXX_SIZEOF (is_elf64, ehdr)) == 0
+ && ELFXX_FLD (is_elf64, ehdr, e_ident[EI_MAG0]) == ELFMAG0
+ && ELFXX_FLD (is_elf64, ehdr, e_ident[EI_MAG1]) == ELFMAG1
+ && ELFXX_FLD (is_elf64, ehdr, e_ident[EI_MAG2]) == ELFMAG2
+ && ELFXX_FLD (is_elf64, ehdr, e_ident[EI_MAG3]) == ELFMAG3)
{
const ElfXX_Phdr *phdr;
void *phdr_buf;
- const unsigned e_phentsize = ELFXX_FLD (ehdr, e_phentsize);
+ const unsigned e_phentsize = ELFXX_FLD (is_elf64, ehdr, e_phentsize);
- gdb_assert (ELFXX_FLD (ehdr, e_phnum) < 100); /* Basic sanity check. */
- gdb_assert (e_phentsize == ELFXX_SIZEOF (*phdr));
- phdr_buf = alloca (ELFXX_FLD (ehdr, e_phnum) * e_phentsize);
+ gdb_assert (ELFXX_FLD (is_elf64, ehdr, e_phnum) < 100); /* Basic sanity check. */
+ gdb_assert (e_phentsize == ELFXX_SIZEOF (is_elf64, *phdr));
+ phdr_buf = alloca (ELFXX_FLD (is_elf64, ehdr, e_phnum) * e_phentsize);
- if (linux_read_memory (load_addr + ELFXX_FLD (ehdr, e_phoff), phdr_buf,
- ELFXX_FLD (ehdr, e_phnum) * e_phentsize) != 0)
+ if (linux_read_memory (load_addr + ELFXX_FLD (is_elf64, ehdr, e_phoff),
+ phdr_buf,
+ ELFXX_FLD (is_elf64, ehdr, e_phnum) * e_phentsize)
+ != 0)
{
warning ("Could not read program header.");
return;
@@ -5806,15 +5809,16 @@ read_build_id (struct find_memory_region_callback_data *const p,
const ElfXX_Nhdr *nhdr;
phdr = find_phdr (p->is_elf64, phdr, (gdb_byte *) phdr_buf
- + ELFXX_FLD (ehdr, e_phnum) * e_phentsize,
+ + ELFXX_FLD (is_elf64, ehdr, e_phnum) * e_phentsize,
PT_NOTE);
if (phdr == NULL)
break;
- pt_note = xmalloc (ELFXX_FLD (*phdr, p_memsz));
- pt_end = (gdb_byte*) pt_note + ELFXX_FLD (*phdr, p_memsz);
+ pt_note = xmalloc (ELFXX_FLD (is_elf64, *phdr, p_memsz));
+ pt_end = (gdb_byte*) pt_note + ELFXX_FLD (is_elf64, *phdr, p_memsz);
- if (linux_read_memory (ELFXX_FLD (*phdr, p_vaddr) + l_addr, pt_note,
- ELFXX_FLD (*phdr, p_memsz)) != 0)
+ if (linux_read_memory (ELFXX_FLD (is_elf64, *phdr, p_vaddr) + l_addr,
+ pt_note, ELFXX_FLD (is_elf64, *phdr, p_memsz))
+ != 0)
{
xfree (pt_note);
warning ("Could not read note.");
@@ -5825,10 +5829,13 @@ read_build_id (struct find_memory_region_callback_data *const p,
while ((void *) nhdr < (void *) pt_end)
{
const size_t namesz
- = ELFXX_ROUNDUP (ELFXX_FLD (*nhdr, n_namesz));
+ = ELFXX_ROUNDUP_4 (is_elf64, ELFXX_FLD (is_elf64, *nhdr,
+ n_namesz));
const size_t descsz
- = ELFXX_ROUNDUP (ELFXX_FLD (*nhdr, n_descsz));
- const size_t note_sz = ELFXX_SIZEOF (*nhdr) + namesz + descsz;
+ = ELFXX_ROUNDUP_4 (is_elf64, ELFXX_FLD (is_elf64, *nhdr,
+ n_descsz));
+ const size_t note_sz = ELFXX_SIZEOF (is_elf64, *nhdr) + namesz
+ + descsz;
if (((gdb_byte *) nhdr + note_sz) > pt_end || note_sz == 0
|| descsz == 0)
@@ -5836,16 +5843,17 @@ read_build_id (struct find_memory_region_callback_data *const p,
warning ("Malformed PT_NOTE\n");
break;
}
- if (ELFXX_FLD (*nhdr, n_type) == NT_GNU_BUILD_ID
- && ELFXX_FLD (*nhdr, n_namesz) == 4)
+ if (ELFXX_FLD (is_elf64, *nhdr, n_type) == NT_GNU_BUILD_ID
+ && ELFXX_FLD (is_elf64, *nhdr, n_namesz) == 4)
{
const char gnu[4] = "GNU\0";
const char *const pname
- = (char *) nhdr + ELFXX_SIZEOF (*nhdr);
+ = (char *) nhdr + ELFXX_SIZEOF (is_elf64, *nhdr);
if (memcmp (pname, gnu, 4) == 0)
{
- const size_t n_descsz = ELFXX_FLD (*nhdr, n_descsz);
+ const size_t n_descsz = ELFXX_FLD (is_elf64, *nhdr,
+ n_descsz);
bil->hex_build_id = xmalloc (n_descsz * 2 + 1);
bin2hex ((gdb_byte*) pname + namesz, bil->hex_build_id,
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 54a7e6f..d576245 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -881,6 +881,7 @@ svr4_validate (const struct so_list *const so)
{
gdb_byte *build_id;
size_t build_idsz;
+ size_t abfd_build_idsz;
gdb_assert (so != NULL);
@@ -894,6 +895,7 @@ svr4_validate (const struct so_list *const so)
build_id = so->build_id;
build_idsz = so->build_idsz;
+ abfd_build_idsz = elf_tdata (so->abfd)->build_id->size;
if (build_id == NULL)
{
@@ -930,7 +932,7 @@ svr4_validate (const struct so_list *const so)
sizeof (note->descsz),
byte_order);
- if (build_idsz == elf_tdata (so->abfd)->build_id->size)
+ if (build_idsz == abfd_build_idsz)
{
const char gnu[4] = "GNU\0";
@@ -945,9 +947,8 @@ svr4_validate (const struct so_list *const so)
/* Rounded to next sizeof (ElfXX_Word). */
namesz = ((namesz + (sizeof (note->namesz) - 1))
& ~((ULONGEST) (sizeof (note->namesz) - 1)));
- build_id_offs = (sizeof (note->namesz)
- + sizeof (note->descsz)
- + sizeof (note->type) + namesz);
+ build_id_offs = (offsetof (Elf_External_Note, name)
+ + namesz);
build_id = xmalloc (build_idsz);
memcpy (build_id, note_raw + build_id_offs, build_idsz);
}
@@ -971,9 +972,9 @@ svr4_validate (const struct so_list *const so)
if (build_id != NULL)
{
const int match
- = elf_tdata (so->abfd)->build_id->size == build_idsz
- && memcmp (build_id, elf_tdata (so->abfd)->build_id->data,
- elf_tdata (so->abfd)->build_id->size) == 0;
+ = (abfd_build_idsz == build_idsz
+ && memcmp (build_id, elf_tdata (so->abfd)->build_id->data,
+ build_idsz) == 0);
if (build_id != so->build_id)
xfree (build_id);
@@ -1130,12 +1131,14 @@ library_list_start_library (struct gdb_xml_parser *parser,
{
const size_t hex_build_id_len = strlen (hex_build_id);
- if (hex_build_id_len > 0)
+ if (hex_build_id_len > 0 && (hex_build_id_len & 1U) == 0)
{
- new_elem->build_id = xmalloc (hex_build_id_len / 2);
+ const size_t build_idsz = hex_build_id_len / 2;
+
+ new_elem->build_id = xmalloc (build_idsz);
new_elem->build_idsz = hex2bin (hex_build_id, new_elem->build_id,
- hex_build_id_len);
- if (new_elem->build_idsz != (hex_build_id_len / 2))
+ build_idsz);
+ if (new_elem->build_idsz != build_idsz)
{
xfree (new_elem->build_id);
new_elem->build_id = NULL;
diff --git a/gdb/solib.c b/gdb/solib.c
index 20c709e..9950338 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -465,12 +465,6 @@ solib_map_sections (struct so_list *so)
/* Leave bfd open, core_xfer_memory and "info files" need it. */
so->abfd = abfd;
- /* copy full path name into so_name, so that later symbol_file_add
- can find it. */
- if (strlen (bfd_get_filename (abfd)) >= SO_NAME_MAX_PATH_SIZE)
- error (_("Shared library file name is too long."));
- strcpy (so->so_name, bfd_get_filename (abfd));
-
gdb_assert (ops->validate != NULL);
if (!ops->validate (so))
diff --git a/gdb/target.c b/gdb/target.c
index 1a7e091..db06389 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3477,6 +3477,11 @@ target_fileio_close_cleanup (void *opaque)
target_fileio_close (fd, &target_errno);
}
+typedef int (read_alloc_pread_ftype) (int handle, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *target_errno);
+
+static read_alloc_pread_ftype target_fileio_read_alloc_1_pread;
+
/* Helper for target_fileio_read_alloc_1 to make it interruptible. */
static int
@@ -3488,6 +3493,11 @@ target_fileio_read_alloc_1_pread (int handle, gdb_byte *read_buf, int len,
return target_fileio_pread (handle, read_buf, len, offset, target_errno);
}
+typedef LONGEST (read_stralloc_func_ftype) (const char *filename,
+ gdb_byte **buf_p, int padding);
+
+static read_stralloc_func_ftype target_fileio_read_alloc_1;
+
/* Read target file FILENAME. Store the result in *BUF_P and
return the size of the transferred data. PADDING additional bytes are
available in *BUF_P. This is a helper function for
diff --git a/gdb/testsuite/gdb.base/solib-mismatch.c b/gdb/testsuite/gdb.base/solib-mismatch.c
index 8a7f58f..7a5d960 100644
--- a/gdb/testsuite/gdb.base/solib-mismatch.c
+++ b/gdb/testsuite/gdb.base/solib-mismatch.c
@@ -24,45 +24,33 @@
/* The following defines must correspond to solib-mismatch.exp */
-#define DIRNAME "solib-mismatch_wd"
-#define LIB "./solib-mismatch.so"
-
-int main(int argc, char *argv[])
+/* DIRNAME must be defined at compile time. */
+#ifndef DIRNAME
+#error DIRNAME not defined
+#endif
+#ifndef LIB
+#error LIB not defined
+#endif
+
+int main (int argc, char *argv[])
{
void *h;
- int (*foo)(void);
- char buff[1024];
- char *p;
-
- p = strstr (argv[0], DIRNAME);
-
- if (p == NULL)
- {
- printf ("ERROR - %s could not be found in argv[0]\n", DIRNAME);
- return 1;
- }
-
- p += strlen (DIRNAME);
-
- memcpy (buff, argv[0], p - argv[0]);
+ int (*foo) (void);
- buff[p - argv[0]] = '\0';
-
- if (chdir (buff) != 0)
+ if (chdir (DIRNAME) != 0)
{
- printf ("ERROR - Could not cd to %s\n", buff);
+ printf ("ERROR - Could not cd to %s\n", DIRNAME);
return 1;
}
- h = dlopen(LIB, RTLD_NOW);
+ h = dlopen (LIB, RTLD_NOW);
if (h == NULL)
{
printf ("ERROR - could not open lib %s\n", LIB);
return 1;
}
- foo = dlsym(h, "foo"); /* set breakpoint 1 here */
- dlclose(h);
+ foo = dlsym (h, "foo"); /* set breakpoint 1 here */
+ dlclose (h);
return 0;
}
-
diff --git a/gdb/testsuite/gdb.base/solib-mismatch.exp b/gdb/testsuite/gdb.base/solib-mismatch.exp
index a242618..4504bc3 100644
--- a/gdb/testsuite/gdb.base/solib-mismatch.exp
+++ b/gdb/testsuite/gdb.base/solib-mismatch.exp
@@ -23,6 +23,7 @@ set executable $testfile
if { [get_compiler_info] } {
untested "get_compiler_info failed."
+ return -1
}
# First version of the object, to be loaded by ld.
@@ -34,7 +35,7 @@ set srclibfilerun ${testfile}-lib.c
set srclibfilegdb ${testfile}-libmod.c
# So file name:
-set binlibfilebase ${testfile}.so
+set binlibfilebase lib${testfile}.so
# Setup run directory (where program is run from)
# It contains executable and '-lib' version of the library.
@@ -45,27 +46,29 @@ set binlibfilerun ${binlibfiledirrun}/${binlibfilebase}
set binlibfiledirgdb [standard_output_file ""]
set binlibfilegdb ${binlibfiledirgdb}/${binlibfilebase}
-# Executeable
+# Executable
set srcfile ${testfile}.c
set executable ${testfile}
-set objfile [standard_output_file ${executable}.o]
-set binfile [standard_output_file ${executable}]
+file delete -force -- "${binlibfiledirrun}"
file mkdir "${binlibfiledirrun}"
set exec_opts {}
if { ![istarget "*-*-nto-*"] } {
- set exec_opts [list debug shlib_load]
+ lappend exec_opts "shlib_load"
}
-if { [prepare_for_testing $testfile.exp $executable $srcfile $exec_opts] != 0 } {
+lappend exec_opts "additional_flags=-DDIRNAME\=\"${binlibfiledirrun}\" -DLIB\=\"./${binlibfilebase}\""
+lappend exec_opts "debug"
+
+if { [build_executable $testfile.exp $executable $srcfile $exec_opts] != 0 } {
return -1
}
-if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfilerun}" "${binlibfilerun}" [list debug ldflags=-Wl,-soname,${binlibfilebase},--build-id]] != ""
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfilerun}" "${binlibfilerun}" [list debug ldflags=-Wl,--build-id]] != ""
|| [gdb_gnu_strip_debug "${binlibfilerun}"]
- || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfilegdb}" "${binlibfilegdb}" [list debug ldflags=-Wl,-soname,${binlibfilebase},--build-id]] != "" } {
+ || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfilegdb}" "${binlibfilegdb}" [list debug ldflags=-Wl,--build-id]] != "" } {
untested "gdb_compile_shlib failed."
return -1
}
@@ -82,21 +85,21 @@ proc solib_matching_test { solibfile symsloaded msg } {
clean_restart ${binlibfiledirrun}/${executable}
- send_gdb "set solib-search-path \"${binlibfiledirgdb}\"\n"
- send_gdb "cd ${binlibfiledirgdb}\n"
-# Do not auto load shared libraries, the test needs to have control
-# over when the relevant output gets printed
- send_gdb "set auto-solib-add off\n"
+ gdb_test_no_output "set solib-search-path \"${binlibfiledirgdb}\"" ""
+ if { [gdb_test "cd ${binlibfiledirgdb}" "" ""] != 0 } {
+ untested "cd ${binlibfiledirgdb}"
+ return -1
+ }
- set bp_location [gdb_get_line_number "set breakpoint 1 here"]
+ # Do not auto load shared libraries, the test needs to have control
+ # over when the relevant output gets printed.
+ gdb_test_no_output "set auto-solib-add off" ""
- gdb_breakpoint ${srcfile}:${bp_location} temporary no-message
+ if ![runto "${srcfile}:[gdb_get_line_number "set breakpoint 1 here"]"] {
+ return -1
+ }
- gdb_run_cmd { ${binlibfiledirrun} }
- gdb_test "" "set breakpoint 1 here.*" ""
-
- send_gdb "sharedlibrary\n"
- gdb_test "" "" ""
+ gdb_test "sharedlibrary" "" ""
set nocrlf "\[^\r\n\]*"
set expected_header "From${nocrlf}To${nocrlf}Syms${nocrlf}Read${nocrlf}Shared${nocrlf}"
@@ -105,6 +108,7 @@ proc solib_matching_test { solibfile symsloaded msg } {
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-16 13:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-16 13:19 [SCM] aristovski/validate-binary-before-use: Tests for validate symbol file using build-id aristovski
-- strict thread matches above, loose matches on Subject: below --
2013-04-15 19:52 aristovski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).