Fix inferior calls, particularly uncaught thrown exceptions (BZ 799531).

- Fix DWARF DIEs CU vs. section relative offsets (Joel Brobecker, me).
This commit is contained in:
Jan Kratochvil 2012-03-09 00:17:10 +01:00
parent c64e73263b
commit d8e4a58344
4 changed files with 176 additions and 1 deletions

View File

@ -0,0 +1,99 @@
[commit] [patch] Fix CU relative vs. absolute offsets [Re: RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback]
http://sourceware.org/ml/gdb-patches/2012-03/msg00284.html
http://sourceware.org/ml/gdb-cvs/2012-03/msg00134.html
### src/gdb/ChangeLog 2012/03/08 19:08:09 1.13979
### src/gdb/ChangeLog 2012/03/08 19:37:04 1.13980
## -1,5 +1,15 @@
2012-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Fix CU relative vs. absolute DIE offsets.
+ * dwarf2loc.h (dwarf2_fetch_die_location_block): Rename parameter
+ offset to offset_in_cu.
+ * dwarf2read.c (process_enumeration_scope): Add CU offset to
+ TYPE_OFFSET.
+ (dwarf2_fetch_die_location_block): Rename parameter offset to
+ offset_in_cu. New variable offset, add CU offset to OFFSET_IN_CU.
+
+2012-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* libunwind-frame.c: Rename to ...
* ia64-libunwind-tdep.c: ... here.
* libunwind-frame.h: Rename to ...
--- src/gdb/dwarf2loc.h 2012/01/05 21:53:14 1.29
+++ src/gdb/dwarf2loc.h 2012/03/08 19:37:07 1.30
@@ -61,7 +61,7 @@
CORE_ADDR pc);
struct dwarf2_locexpr_baton dwarf2_fetch_die_location_block
- (unsigned int offset, struct dwarf2_per_cu_data *per_cu,
+ (unsigned int offset_in_cu, struct dwarf2_per_cu_data *per_cu,
CORE_ADDR (*get_frame_pc) (void *baton),
void *baton);
--- src/gdb/dwarf2read.c 2012/03/06 23:41:50 1.619
+++ src/gdb/dwarf2read.c 2012/03/08 19:37:07 1.620
@@ -8031,7 +8031,8 @@
= lookup_signatured_type_at_offset (dwarf2_per_objfile->objfile,
cu->per_cu->debug_types_section,
cu->per_cu->offset);
- if (type_sig->type_offset != die->offset)
+ if (type_sig->per_cu.offset + type_sig->type_offset
+ != die->offset)
return;
}
@@ -14202,11 +14203,12 @@
dwarf2_locexpr_baton->data has lifetime of PER_CU->OBJFILE. */
struct dwarf2_locexpr_baton
-dwarf2_fetch_die_location_block (unsigned int offset,
+dwarf2_fetch_die_location_block (unsigned int offset_in_cu,
struct dwarf2_per_cu_data *per_cu,
CORE_ADDR (*get_frame_pc) (void *baton),
void *baton)
{
+ unsigned int offset = per_cu->offset + offset_in_cu;
struct dwarf2_cu *cu;
struct die_info *die;
struct attribute *attr;
### src/gdb/testsuite/ChangeLog 2012/03/08 07:42:50 1.3127
### src/gdb/testsuite/ChangeLog 2012/03/08 19:37:07 1.3128
## -1,5 +1,11 @@
2012-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Fix CU relative vs. absolute DIE offsets.
+ * gdb.dwarf2/dw2-op-call.S: New compilation unit preceding the existing
+ one.
+
+2012-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Fix false FAIL on distros with relro linkage as default.
* gdb.reverse/solib-precsave.exp: Try to compile the test using
-Wl,-z,norelro first.
--- src/gdb/testsuite/gdb.dwarf2/dw2-op-call.S 2012/01/04 08:17:51 1.5
+++ src/gdb/testsuite/gdb.dwarf2/dw2-op-call.S 2012/03/08 19:37:08 1.6
@@ -23,6 +23,23 @@
array3: .2byte 3
.section .debug_info
+.Lcu0_begin:
+ /* CU header */
+ .4byte .Lcu0_end - .Lcu0_start /* Length of Compilation Unit */
+.Lcu0_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .ascii "file0.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 2 /* DW_LANG_C (C) */
+
+ .byte 0 /* End of children of CU */
+.Lcu0_end:
+
.Lcu1_begin:
/* CU header */
.4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */

View File

@ -0,0 +1,26 @@
RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback
http://sourceware.org/ml/gdb-patches/2012-03/msg00166.html
http://sourceware.org/ml/gdb-cvs/2012-03/msg00118.html
### src/gdb/ChangeLog 2012/03/06 22:48:49 1.13968
### src/gdb/ChangeLog 2012/03/06 23:41:47 1.13969
## -1,3 +1,8 @@
+2012-03-06 Joel Brobecker <brobecker@adacore.com>
+
+ * dwarf2read.c (dwarf2_get_die_type): Pass absolute offset
+ in call to get_die_type_at_offset.
+
2012-03-06 Stan Shebs <stan@codesourcery.com>
* mi/mi-cmd-break.c: Enforce coding standards, fix comments.
--- src/gdb/dwarf2read.c 2012/03/02 01:55:15 1.618
+++ src/gdb/dwarf2read.c 2012/03/06 23:41:50 1.619
@@ -14269,7 +14269,7 @@
struct dwarf2_per_cu_data *per_cu)
{
dw2_setup (per_cu->objfile);
- return get_die_type_at_offset (die_offset, per_cu);
+ return get_die_type_at_offset (per_cu->offset + die_offset, per_cu);
}
/* Follow the signature attribute ATTR in SRC_DIE.

36
gdb-x86-onstack.patch Executable file
View File

@ -0,0 +1,36 @@
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2326,6 +2326,24 @@ i386_16_byte_align_p (struct type *type)
return 0;
}
+/* Implementation for set_gdbarch_push_dummy_code. */
+
+static CORE_ADDR
+i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
+ struct value **args, int nargs, struct type *value_type,
+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
+ struct regcache *regcache)
+{
+ int bplen;
+ CORE_ADDR bppc = sp;
+
+ gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
+ *bp_addr = sp - bplen;
+ *real_pc = funaddr;
+
+ return *bp_addr;
+}
+
static CORE_ADDR
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
@@ -7372,6 +7390,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
/* Call dummy code. */
+ set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+ set_gdbarch_push_dummy_code (gdbarch, i386_push_dummy_code);
set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call);
set_gdbarch_frame_align (gdbarch, i386_frame_align);

View File

@ -33,7 +33,7 @@ Version: 7.4.50.%{snap}
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 28%{?dist}
Release: 29%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
Group: Development/Debuggers
@ -560,6 +560,13 @@ Patch651: gdb-attach-fail-reasons-3of5.patch
Patch652: gdb-attach-fail-reasons-4of5.patch
Patch653: gdb-attach-fail-reasons-5of5.patch
# Fix inferior calls, particularly uncaught thrown exceptions (BZ 799531).
Patch654: gdb-x86-onstack.patch
# Fix DWARF DIEs CU vs. section relative offsets (Joel Brobecker, me).
Patch655: gdb-die-cu-offset-1of2.patch
Patch656: gdb-die-cu-offset-2of2.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
# Patch642: gdb-readline62-ask-more-rh.patch
@ -843,6 +850,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch651 -p1
%patch652 -p1
%patch653 -p1
%patch654 -p1
%patch655 -p1
%patch656 -p1
%patch393 -p1
%if 0%{!?el5:1} || 0%{?scl:1}
@ -1309,6 +1319,10 @@ fi
%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
%changelog
* Tue Mar 6 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-29.fc17
- Fix inferior calls, particularly uncaught thrown exceptions (BZ 799531).
- Fix DWARF DIEs CU vs. section relative offsets (Joel Brobecker, me).
* Tue Mar 6 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-28.fc17
- Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878).