Accepting request 406957 from devel:gcc

- Rebase to gdb 7.11.1: minor bug fixes.
- Remove gdb-gcc6-Wparentheses-warning.patch (applied upstream).
- Add some patches from Fedora F24:
  gdb-bare-DW_TAG_lexical_block-1of2.patch
  gdb-bare-DW_TAG_lexical_block-2of2.patch
  gdb-bz1219747-attach-kills.patch
  gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
  gdb-rhbz1325795-framefilters-test.patch
  gdb-testsuite-dw2-undefined-ret-addr.patch

OBS-URL: https://build.opensuse.org/request/show/406957
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=111
This commit is contained in:
Dominique Leuenberger 2016-07-12 21:45:03 +00:00 committed by Git OBS Bridge
commit 2989382cab
13 changed files with 1152 additions and 148 deletions

View File

@ -35,9 +35,9 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
+
+set testfile "dw2-loclist-prelinked"
+set srcfuncfile ${testfile}-func.S
+set binsharedfuncfile ${objdir}/${subdir}/${testfile}.so
+set binsharedfuncfile [standard_output_file ${testfile}.so]
+set srcmainfile ${testfile}-main.c
+set binfile ${objdir}/${subdir}/${testfile}
+set binfile [standard_output_file ${testfile}]
+
+remote_exec build "rm -f ${binfile}"
+

3
gdb-7.11.1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:52497db17119a21d59bc62ac5f1138b8061990f97fee6138c4e8b4d7104e67e0
size 27307242

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2067c07a96dd5fc6fb4c4aafba0c439a50d0ba74e330d41a3d83d09933296d34
size 27335115

View File

@ -0,0 +1,235 @@
From 3a2b436ae9958a1029545c03201b7223ff33c150 Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon, 30 May 2016 14:11:43 +0200
Subject: [PATCH 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
Make the code (maybe) more readable + primarily prepare it for [patch 2/2]
enum extension.
This change should have no code change impact.
gdb/ChangeLog
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
* dwarf2read.c (enum pc_bounds_kind) New.
(dwarf2_get_pc_bounds): Use it in the declaration.
(process_psymtab_comp_unit_reader): Adjust caller. Rename has_pc_info
to cu_bounds_kind.
(read_func_scope, read_lexical_block_scope, read_call_site_scope):
Adjust callers.
(dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition.
(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
---
gdb/ChangeLog | 12 ++++++++++
gdb/dwarf2read.c | 71 ++++++++++++++++++++++++++++++++++++--------------------
2 files changed, 58 insertions(+), 25 deletions(-)
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,15 @@
+2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
+ * dwarf2read.c (enum pc_bounds_kind) New.
+ (dwarf2_get_pc_bounds): Use it in the declaration.
+ (process_psymtab_comp_unit_reader): Adjust caller. Rename has_pc_info
+ to cu_bounds_kind.
+ (read_func_scope, read_lexical_block_scope, read_call_site_scope):
+ Adjust callers.
+ (dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition.
+ (dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
+
2016-05-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (QCatchSyscalls): Remove the parameter. Include ...
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1606,9 +1606,25 @@ static void read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu);
static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
struct dwarf2_cu *, struct partial_symtab *);
-static int dwarf2_get_pc_bounds (struct die_info *,
- CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *,
- struct partial_symtab *);
+/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
+ values. */
+enum pc_bounds_kind
+{
+ /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
+ was found. */
+ PC_BOUNDS_NOT_PRESENT,
+
+ /* Discontiguous range was found - that is DW_AT_ranges was found. */
+ PC_BOUNDS_RANGES,
+
+ /* Contiguous range was found - DW_AT_low_pc and DW_AT_high_pc were found. */
+ PC_BOUNDS_HIGH_LOW,
+};
+
+static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
+ CORE_ADDR *, CORE_ADDR *,
+ struct dwarf2_cu *,
+ struct partial_symtab *);
static void get_scope_pc_bounds (struct die_info *,
CORE_ADDR *, CORE_ADDR *,
@@ -5947,7 +5963,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
CORE_ADDR baseaddr;
CORE_ADDR best_lowpc = 0, best_highpc = 0;
struct partial_symtab *pst;
- int has_pc_info;
+ enum pc_bounds_kind cu_bounds_kind;
const char *filename;
struct process_psymtab_comp_unit_data *info
= (struct process_psymtab_comp_unit_data *) data;
@@ -5977,9 +5993,9 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
/* Possibly set the default values of LOWPC and HIGHPC from
`DW_AT_ranges'. */
- has_pc_info = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
- &best_highpc, cu, pst);
- if (has_pc_info == 1 && best_lowpc < best_highpc)
+ cu_bounds_kind = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
+ &best_highpc, cu, pst);
+ if (cu_bounds_kind == PC_BOUNDS_HIGH_LOW && best_lowpc < best_highpc)
/* Store the contiguous range if it is not empty; it can be empty for
CUs with no code. */
addrmap_set_empty (objfile->psymtabs_addrmap,
@@ -6003,7 +6019,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
first_die = load_partial_dies (reader, info_ptr, 1);
scan_partial_symbols (first_die, &lowpc, &highpc,
- ! has_pc_info, cu);
+ cu_bounds_kind == PC_BOUNDS_NOT_PRESENT, cu);
/* If we didn't find a lowpc, set it to highpc to avoid
complaints from `maint check'. */
@@ -6012,7 +6028,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
/* If the compilation unit didn't have an explicit address range,
then use the information extracted from its child dies. */
- if (! has_pc_info)
+ if (cu_bounds_kind == PC_BOUNDS_NOT_PRESENT)
{
best_lowpc = lowpc;
best_highpc = highpc;
@@ -11373,7 +11389,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
}
/* Ignore functions with missing or invalid low and high pc attributes. */
- if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+ if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
+ == PC_BOUNDS_NOT_PRESENT)
{
attr = dwarf2_attr (die, DW_AT_external, cu);
if (!attr || !DW_UNSND (attr))
@@ -11535,7 +11552,8 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
as multiple lexical blocks? Handling children in a sane way would
be nasty. Might be easier to properly extend generic blocks to
describe ranges. */
- if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+ if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
+ == PC_BOUNDS_NOT_PRESENT)
return;
lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr);
highpc = gdbarch_adjust_dwarf2_addr (gdbarch, highpc + baseaddr);
@@ -11745,7 +11763,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
CORE_ADDR lowpc;
/* DW_AT_entry_pc should be preferred. */
- if (!dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL))
+ if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
+ == PC_BOUNDS_NOT_PRESENT)
complaint (&symfile_complaints,
_("DW_AT_GNU_call_site_target target DIE has invalid "
"low pc, for referencing DIE 0x%x [in module %s]"),
@@ -12020,11 +12039,11 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
return 1;
}
-/* Get low and high pc attributes from a die. Return 1 if the attributes
- are present and valid, otherwise, return 0. Return -1 if the range is
- discontinuous, i.e. derived from DW_AT_ranges information. */
+/* Get low and high pc attributes from a die. See enum pc_bounds_kind
+ definition for the return value. *LOWPC and *HIGHPC are set iff
+ PC_BOUNDS_NOT_PRESENT is not returned. */
-static int
+static enum pc_bounds_kind
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
CORE_ADDR *highpc, struct dwarf2_cu *cu,
struct partial_symtab *pst)
@@ -12033,7 +12052,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
struct attribute *attr_high;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
- int ret = 0;
+ enum pc_bounds_kind ret = PC_BOUNDS_NOT_PRESENT;
attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
if (attr_high)
@@ -12048,10 +12067,10 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
}
else
/* Found high w/o low attribute. */
- return 0;
+ return PC_BOUNDS_NOT_PRESENT;
/* Found consecutive range of addresses. */
- ret = 1;
+ ret = PC_BOUNDS_HIGH_LOW;
}
else
{
@@ -12070,15 +12089,15 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
/* Value of the DW_AT_ranges attribute is the offset in the
.debug_ranges section. */
if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst))
- return 0;
+ return PC_BOUNDS_NOT_PRESENT;
/* Found discontinuous range of addresses. */
- ret = -1;
+ ret = PC_BOUNDS_RANGES;
}
}
/* read_partial_die has also the strict LOW < HIGH requirement. */
if (high <= low)
- return 0;
+ return PC_BOUNDS_NOT_PRESENT;
/* When using the GNU linker, .gnu.linkonce. sections are used to
eliminate duplicate copies of functions and vtables and such.
@@ -12089,7 +12108,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
If this is a discarded function, mark the pc bounds as invalid,
so that GDB will ignore it. */
if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
- return 0;
+ return PC_BOUNDS_NOT_PRESENT;
*lowpc = low;
if (highpc)
@@ -12110,7 +12129,8 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
CORE_ADDR low, high;
struct die_info *child = die->child;
- if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL))
+ if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)
+ != PC_BOUNDS_NOT_PRESENT)
{
*lowpc = min (*lowpc, low);
*highpc = max (*highpc, high);
@@ -12147,7 +12167,8 @@ get_scope_pc_bounds (struct die_info *die,
CORE_ADDR best_high = (CORE_ADDR) 0;
CORE_ADDR current_low, current_high;
- if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL))
+ if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL)
+ != PC_BOUNDS_NOT_PRESENT)
{
best_low = current_low;
best_high = current_high;
--
2.5.5

View File

@ -0,0 +1,343 @@
From e385593eef98ac92be57159e141f4b805dadbbb3 Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon, 30 May 2016 14:14:43 +0200
Subject: [PATCH 2/2] PR 15231: import bare DW_TAG_lexical_block
Local variables in lambdas are not accessible
https://sourceware.org/bugzilla/show_bug.cgi?id=15231
GDB: read_lexical_block_scope
/* Ignore blocks with missing or invalid low and high pc attributes. */
[...]
if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
return;
But sometimes there is:
FAIL: gcc-5.3.1-6.fc23.x86_64
<2><92>: Abbrev Number: 11 (DW_TAG_lexical_block)
<3><9c>: Abbrev Number: 13 (DW_TAG_structure_type)
<9d> DW_AT_name : (indirect string, offset: 0x3c): <lambda()>
[...]
Where DW_TAG_lexical_block has no attributes. Such whole subtree is currently
dropped by GDB while I think it should just import all its children DIEs.
It even XFAIL->XPASSes gdb.ada/out_of_line_in_inlined.exp:
commit 0fa7fe506c242b459c4c05d331e7c7d66fb52390
Author: Joel Brobecker <brobecker@adacore.com>
out of line functions nested inside inline functions.
So I have removed that xfail.
gdb/ChangeLog
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
PR c++/15231
* dwarf2read.c (enum pc_bounds_kind): Add PC_BOUNDS_INVALID.
(process_psymtab_comp_unit_reader, read_func_scope): Adjust callers.
(read_lexical_block_scope): Import DIEs from bare DW_TAG_lexical_block.
(read_call_site_scope): Adjust callers.
(dwarf2_get_pc_bounds): Implement pc_bounds_invalid.
(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
gdb/testsuite/ChangeLog
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
PR c++/15231
* gdb.ada/out_of_line_in_inlined.exp: Remove xfails.
* gdb.dwarf2/dw2-lexical-block-bare.exp: New file.
---
gdb/ChangeLog | 10 ++++
gdb/dwarf2read.c | 53 ++++++++++------
gdb/testsuite/ChangeLog | 6 ++
gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 6 --
.../gdb.dwarf2/dw2-lexical-block-bare.exp | 70 ++++++++++++++++++++++
5 files changed, 120 insertions(+), 25 deletions(-)
create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,15 @@
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+ PR c++/15231
+ * dwarf2read.c (enum pc_bounds_kind): Add PC_BOUNDS_INVALID.
+ (process_psymtab_comp_unit_reader, read_func_scope): Adjust callers.
+ (read_lexical_block_scope): Import DIEs from bare DW_TAG_lexical_block.
+ (read_call_site_scope): Adjust callers.
+ (dwarf2_get_pc_bounds): Implement pc_bounds_invalid.
+ (dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
+
+2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
* dwarf2read.c (enum pc_bounds_kind) New.
(dwarf2_get_pc_bounds): Use it in the declaration.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1607,13 +1607,16 @@ static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
struct dwarf2_cu *, struct partial_symtab *);
/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
- values. */
+ values. Keep the items ordered with increasing constraints compliance. */
enum pc_bounds_kind
{
- /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
- was found. */
+ /* No attribute DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges was found. */
PC_BOUNDS_NOT_PRESENT,
+ /* Some of the attributes DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
+ were present but they do not form a valid range of PC addresses. */
+ PC_BOUNDS_INVALID,
+
/* Discontiguous range was found - that is DW_AT_ranges was found. */
PC_BOUNDS_RANGES,
@@ -6019,7 +6022,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
first_die = load_partial_dies (reader, info_ptr, 1);
scan_partial_symbols (first_die, &lowpc, &highpc,
- cu_bounds_kind == PC_BOUNDS_NOT_PRESENT, cu);
+ cu_bounds_kind <= PC_BOUNDS_INVALID, cu);
/* If we didn't find a lowpc, set it to highpc to avoid
complaints from `maint check'. */
@@ -6028,7 +6031,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
/* If the compilation unit didn't have an explicit address range,
then use the information extracted from its child dies. */
- if (cu_bounds_kind == PC_BOUNDS_NOT_PRESENT)
+ if (cu_bounds_kind <= PC_BOUNDS_INVALID)
{
best_lowpc = lowpc;
best_highpc = highpc;
@@ -11390,7 +11393,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
/* Ignore functions with missing or invalid low and high pc attributes. */
if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
- == PC_BOUNDS_NOT_PRESENT)
+ <= PC_BOUNDS_INVALID)
{
attr = dwarf2_attr (die, DW_AT_external, cu);
if (!attr || !DW_UNSND (attr))
@@ -11552,9 +11555,20 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
as multiple lexical blocks? Handling children in a sane way would
be nasty. Might be easier to properly extend generic blocks to
describe ranges. */
- if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
- == PC_BOUNDS_NOT_PRESENT)
- return;
+ switch (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+ {
+ case PC_BOUNDS_NOT_PRESENT:
+ /* DW_TAG_lexical_block has no attributes, process its children as if
+ there was no wrapping by that DW_TAG_lexical_block.
+ GCC does no longer produces such DWARF since GCC r224161. */
+ for (child_die = die->child;
+ child_die != NULL && child_die->tag;
+ child_die = sibling_die (child_die))
+ process_die (child_die, cu);
+ return;
+ case PC_BOUNDS_INVALID:
+ return;
+ }
lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr);
highpc = gdbarch_adjust_dwarf2_addr (gdbarch, highpc + baseaddr);
@@ -11764,7 +11778,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
/* DW_AT_entry_pc should be preferred. */
if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
- == PC_BOUNDS_NOT_PRESENT)
+ <= PC_BOUNDS_INVALID)
complaint (&symfile_complaints,
_("DW_AT_GNU_call_site_target target DIE has invalid "
"low pc, for referencing DIE 0x%x [in module %s]"),
@@ -12041,7 +12055,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
/* Get low and high pc attributes from a die. See enum pc_bounds_kind
definition for the return value. *LOWPC and *HIGHPC are set iff
- PC_BOUNDS_NOT_PRESENT is not returned. */
+ neither PC_BOUNDS_NOT_PRESENT nor PC_BOUNDS_INVALID are returned. */
static enum pc_bounds_kind
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
@@ -12052,7 +12066,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
struct attribute *attr_high;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
- enum pc_bounds_kind ret = PC_BOUNDS_NOT_PRESENT;
+ enum pc_bounds_kind ret;
attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
if (attr_high)
@@ -12067,7 +12081,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
}
else
/* Found high w/o low attribute. */
- return PC_BOUNDS_NOT_PRESENT;
+ return PC_BOUNDS_INVALID;
/* Found consecutive range of addresses. */
ret = PC_BOUNDS_HIGH_LOW;
@@ -12089,15 +12103,17 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
/* Value of the DW_AT_ranges attribute is the offset in the
.debug_ranges section. */
if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst))
- return PC_BOUNDS_NOT_PRESENT;
+ return PC_BOUNDS_INVALID;
/* Found discontinuous range of addresses. */
ret = PC_BOUNDS_RANGES;
}
+ else
+ return PC_BOUNDS_NOT_PRESENT;
}
/* read_partial_die has also the strict LOW < HIGH requirement. */
if (high <= low)
- return PC_BOUNDS_NOT_PRESENT;
+ return PC_BOUNDS_INVALID;
/* When using the GNU linker, .gnu.linkonce. sections are used to
eliminate duplicate copies of functions and vtables and such.
@@ -12108,7 +12124,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
If this is a discarded function, mark the pc bounds as invalid,
so that GDB will ignore it. */
if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
- return PC_BOUNDS_NOT_PRESENT;
+ return PC_BOUNDS_INVALID;
*lowpc = low;
if (highpc)
@@ -12129,8 +12145,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
CORE_ADDR low, high;
struct die_info *child = die->child;
- if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)
- != PC_BOUNDS_NOT_PRESENT)
+ if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL) >= PC_BOUNDS_RANGES)
{
*lowpc = min (*lowpc, low);
*highpc = max (*highpc, high);
@@ -12168,7 +12183,7 @@ get_scope_pc_bounds (struct die_info *die,
CORE_ADDR current_low, current_high;
if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL)
- != PC_BOUNDS_NOT_PRESENT)
+ >= PC_BOUNDS_RANGES)
{
best_low = current_low;
best_high = current_high;
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,9 @@
+2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ PR c++/15231
+ * gdb.ada/out_of_line_in_inlined.exp: Remove xfails.
+ * gdb.dwarf2/dw2-lexical-block-bare.exp: New file.
+
2016-05-27 Pedro Alves <palves@redhat.com>
* gdb.threads/attach-many-short-lived-threads.exp (bad_dejagnu):
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
@@ -23,20 +23,14 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug optimize=-O2}]
clean_restart ${testfile}
-# GCC currently is missing a DW_AT_origin attribute in one of the
-# lexical blocks, preventing GDB from creating a symbol for the
-# subprogram we want to break on.
-setup_xfail "*-*-*"
gdb_test "break foo_o224_021.child1.child2" \
"Breakpoint \[0-9\]+ at.*: file .*foo_o224_021.adb, line \[0-9\]+."
gdb_run_cmd
-setup_xfail "*-*-*"
gdb_test "" \
"Breakpoint $decimal, foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*"
set opt_addr_in "($hex in)?"
-setup_xfail "*-*-*"
gdb_test "bt" \
[multi_line "#0 +$opt_addr_in +foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \
"#1 +$opt_addr_in +foo_o224_021\\.child1 \\(\\).*" \
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lexical-block-bare.exp
@@ -0,0 +1,70 @@
+# Copyright 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+standard_testfile .S main.c
+
+# Make some DWARF for the test.
+set asm_file [standard_output_file $srcfile]
+Dwarf::assemble $asm_file {
+ cu {} {
+ compile_unit {
+ {low_pc [gdb_target_symbol main] DW_FORM_addr}
+ {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
+ } {
+ declare_labels integer_label
+
+ integer_label: DW_TAG_base_type {
+ {DW_AT_byte_size 4 DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_signed}
+ {DW_AT_name integer}
+ }
+
+ DW_TAG_subprogram {
+ {name main}
+ {DW_AT_external 1 flag}
+ {low_pc [gdb_target_symbol main] DW_FORM_addr}
+ {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
+ } {
+ DW_TAG_lexical_block {
+ } {
+ DW_TAG_variable {
+ {DW_AT_name testvar}
+ {DW_AT_type :$integer_label}
+ {DW_AT_external 1 flag}
+ {DW_AT_location {
+ DW_OP_addr [gdb_target_symbol main]
+ } SPECIAL_expr}
+ }
+ }
+ }
+ }
+ }
+}
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
+ [list $srcfile2 $asm_file] {nodebug}] } {
+ return -1
+}
+
+runto_main
+
+# FAILing GDB did print: No symbol "testvar" in current context.
+gdb_test "p testvar" { = -?[0-9]+}
--
2.5.5

View File

@ -0,0 +1,222 @@
http://sourceware.org/ml/gdb-patches/2015-10/msg00301.html
Subject: [PATCH 1/3] Never kill PID on: gdb exec PID
Hi,
in some cases with deleted main executable GDB will want to kill the inferior.
$ cp /bin/sleep /tmp/sleep;/tmp/sleep 1h&p=$!
$ rm /tmp/sleep
$ gdb /tmp/sleep $p
GNU gdb (GDB) 7.10.50.20151016-cvs
/tmp/sleep: No such file or directory.
Attaching to process 9694
/tmp/sleep (deleted): No such file or directory.
A program is being debugged already. Kill it? (y or n) _
The first attachment of "/tmp/sleep" commandline argument errors at:
#0 throw_error (error=GENERIC_ERROR, fmt=0x116d135 "%s.") at ./common/common-exceptions.c:371
#1 in throw_perror_with_name (errcode=GENERIC_ERROR, string=0x7fffffffdb96 "/dfsfds") at utils.c:974
#2 in perror_with_name (string=0x7fffffffdb96 "/dfsfds") at utils.c:982
#3 in exec_file_attach (filename=0x7fffffffdb96 "/dfsfds", from_tty=1) at exec.c:268
267 if (scratch_chan < 0)
268 perror_with_name (filename);
#4 in catch_command_errors_const (command=0x80f59f <exec_file_attach>, arg=0x7fffffffdb96 "/dfsfds", from_tty=1) at main.c:395
#5 in captured_main (data=0x7fffffffd6f0) at main.c:1051
1051 if (catch_command_errors_const (exec_file_attach, execarg,
1052 !batch_flag))
Then GDB tries to attach to the process $p:
#0 inferior_appeared (inf=0x240e0b0, pid=29210) at inferior.c:305
#1 in inf_ptrace_attach (ops=0x2339540, args=0x21dcdc0 "29210", from_tty=1) at inf-ptrace.c:206
#2 in linux_nat_attach (ops=0x2339540, args=0x21dcdc0 "29210", from_tty=1) at linux-nat.c:1278
#3 in attach_command (args=0x21dcdc0 "29210", from_tty=1) at infcmd.c:2748
#4 in catch_command_errors (command=0x79d7e5 <attach_command>, arg=0x7fffffffdb9e "29210", from_tty=1) at main.c:368
#5 in captured_main (data=0x7fffffffd6f0) at main.c:1082
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
1083 !batch_flag) == 0)
This succeeds and since this moment GDB has a valid inferior. But despite that
the lines
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
1083 !batch_flag) == 0)
still fail because consequently attach_command() fails to find the associated
executable file:
#0 throw_error (error=GENERIC_ERROR, fmt=0x116d135 "%s.") at ./common/common-exceptions.c:371
#1 in throw_perror_with_name (errcode=GENERIC_ERROR, string=0x2477860 "/tmp/sleep (deleted)") at utils.c:974
#2 in perror_with_name (string=0x2477860 "/tmp/sleep (deleted)") at utils.c:982
#3 in exec_file_attach (filename=0x2477860 "/tmp/sleep (deleted)", from_tty=1) at exec.c:268
267 if (scratch_chan < 0)
268 perror_with_name (filename);
#4 in exec_file_locate_attach (pid=29210, from_tty=1) at exec.c:173
#5 in attach_command_post_wait (args=0x24739b0 "29210", from_tty=1, async_exec=0) at infcmd.c:2628
#6 in attach_command_continuation (args=0x2473590, err=0) at infcmd.c:2700
#7 in do_my_continuations_1 (pmy_chain=0x7fffffffd190, err=0) at continuations.c:59
#8 in do_my_continuations (list=0x240e130, err=0) at continuations.c:83
#9 in do_all_inferior_continuations (err=0) at continuations.c:125
#10 in inferior_event_handler (event_type=INF_EXEC_COMPLETE, client_data=0x0) at inf-loop.c:60
#11 in fetch_inferior_event (client_data=0x0) at infrun.c:3929
#12 in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at inf-loop.c:44
#13 in handle_target_event (error=0, client_data=0x0) at linux-nat.c:4681
#14 in handle_file_event (file_ptr=0x21e4170, ready_mask=1) at event-loop.c:708
#15 in gdb_wait_for_event (block=0) at event-loop.c:834
#16 in gdb_do_one_event () at event-loop.c:298
#17 in wait_sync_command_done () at top.c:373
#18 in maybe_wait_sync_command_done (was_sync=0) at top.c:388
#19 in catch_command_errors (command=0x79d7e5 <attach_command>, arg=0x7fffffffdb9e "29210", from_tty=1) at main.c:370
#20 in captured_main (data=0x7fffffffd6f0) at main.c:1082
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
1083 !batch_flag) == 0)
and therefore GDB executes the following:
(gdb) bt
#5 in query (ctlstr=0x1141ae8 "A program is being debugged already. Kill it? ") at utils.c:1371
#6 in target_preopen (from_tty=1) at target.c:2183
2179 if (have_inferiors ())
2180 {
2181 if (!from_tty
2182 || !have_live_inferiors ()
2183 || query (_("A program is being debugged already. Kill it? ")))
2184 iterate_over_inferiors (dispose_inferior, NULL);
2185 else
2186 error (_("Program not killed."));
2187 }
#7 in core_open (arg=0x7fffffffdb9f "9694", from_tty=1) at corelow.c:283
#8 in core_file_command (filename=0x7fffffffdb9f "9694", from_tty=1) at corefile.c:77
#9 in catch_command_errors (command=0x86ca16 <core_file_command>, arg=0x7fffffffdb9f "9694", from_tty=1) at main.c:368
#10 in captured_main (data=0x7fffffffd6f0) at main.c:1084
1084 catch_command_errors (core_file_command, pid_or_core_arg,
1085 !batch_flag);
No regressions on {x86_64,x86_64-m32,i686}-fedora24pre-linux-gnu.
Thanks,
Jan
gdb/ChangeLog
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* main.c (captured_main): Run core_file_command for pid_or_core_arg
only if not have_inferiors ().
gdb/testsuite/ChangeLog
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/attach-kills.c: New.
* gdb.base/attach-kills.exp: New.
---
gdb/testsuite/gdb.base/attach-kills.c | 25 ++++++++++++++++
gdb/testsuite/gdb.base/attach-kills.exp | 49 +++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 gdb/testsuite/gdb.base/attach-kills.c
create mode 100644 gdb/testsuite/gdb.base/attach-kills.exp
diff --git a/gdb/main.c b/gdb/main.c
index 49c9b68..bc19699 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1080,7 +1080,10 @@ captured_main (void *data)
if (isdigit (pid_or_core_arg[0]))
{
if (catch_command_errors (attach_command, pid_or_core_arg,
- !batch_flag) == 0)
+ !batch_flag) == 0
+ /* attach_command could succeed partially and core_file_command
+ would try to kill it. */
+ && !have_inferiors ())
catch_command_errors (core_file_command, pid_or_core_arg,
!batch_flag);
}
diff --git a/gdb/testsuite/gdb.base/attach-kills.c b/gdb/testsuite/gdb.base/attach-kills.c
new file mode 100644
index 0000000..2398f00
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-kills.c
@@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2015 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+
+int
+main (void)
+{
+ sleep (600);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/attach-kills.exp b/gdb/testsuite/gdb.base/attach-kills.exp
new file mode 100644
index 0000000..9a93cb7
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-kills.exp
@@ -0,0 +1,49 @@
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if { ![can_spawn_for_attach] } {
+ return 0
+}
+
+standard_testfile
+
+if { [build_executable ${testfile}.exp $testfile] == -1 } {
+ return -1
+}
+
+# Start the program running and then wait for a bit, to be sure
+# that it can be attached to.
+
+set test_spawn_id [spawn_wait_for_attach $binfile]
+set testpid [spawn_id_get_pid $test_spawn_id]
+
+remote_exec target "cp -pf -- $binfile $binfile-copy"
+remote_exec target "rm -f -- $binfile"
+
+set test "start gdb"
+set res [gdb_spawn_with_cmdline_opts \
+ "-iex \"set height 0\" -iex \"set width 0\" /DoEsNoTeXySt $testpid"]
+if { $res != 0} {
+ fail "$test (spawn)"
+ kill_wait_spawned_process $test_spawn_id
+ return -1
+}
+gdb_test_multiple "" $test {
+ -re "\r\nAttaching to .*\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+kill_wait_spawned_process $test_spawn_id

View File

@ -1,128 +0,0 @@
From b631e59ba05af7c888838d3e2d6d408bfe60b57f Mon Sep 17 00:00:00 2001
From: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date: Tue, 3 May 2016 09:40:54 +0100
Subject: [PATCH] [gdb] Fix -Wparentheses warnings
2016-05-03 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* symfile.c (find_pc_overlay): Add braces to avoid -Wparentheses
warning.
(find_pc_mapped_section): Likewise.
(list_overlays_command): Likewise.
---
gdb/ChangeLog | 7 ++++++
gdb/symfile.c | 80 ++++++++++++++++++++++++++++++++---------------------------
2 files changed, 50 insertions(+), 37 deletions(-)
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 0d67bfd..ca304b8 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3285,19 +3285,21 @@ find_pc_overlay (CORE_ADDR pc)
struct obj_section *osect, *best_match = NULL;
if (overlay_debugging)
- ALL_OBJSECTIONS (objfile, osect)
- if (section_is_overlay (osect))
- {
- if (pc_in_mapped_range (pc, osect))
+ {
+ ALL_OBJSECTIONS (objfile, osect)
+ if (section_is_overlay (osect))
{
- if (section_is_mapped (osect))
- return osect;
- else
+ if (pc_in_mapped_range (pc, osect))
+ {
+ if (section_is_mapped (osect))
+ return osect;
+ else
+ best_match = osect;
+ }
+ else if (pc_in_unmapped_range (pc, osect))
best_match = osect;
}
- else if (pc_in_unmapped_range (pc, osect))
- best_match = osect;
- }
+ }
return best_match;
}
@@ -3312,9 +3314,11 @@ find_pc_mapped_section (CORE_ADDR pc)
struct obj_section *osect;
if (overlay_debugging)
- ALL_OBJSECTIONS (objfile, osect)
- if (pc_in_mapped_range (pc, osect) && section_is_mapped (osect))
- return osect;
+ {
+ ALL_OBJSECTIONS (objfile, osect)
+ if (pc_in_mapped_range (pc, osect) && section_is_mapped (osect))
+ return osect;
+ }
return NULL;
}
@@ -3330,31 +3334,33 @@ list_overlays_command (char *args, int from_tty)
struct obj_section *osect;
if (overlay_debugging)
- ALL_OBJSECTIONS (objfile, osect)
+ {
+ ALL_OBJSECTIONS (objfile, osect)
if (section_is_mapped (osect))
- {
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
- const char *name;
- bfd_vma lma, vma;
- int size;
-
- vma = bfd_section_vma (objfile->obfd, osect->the_bfd_section);
- lma = bfd_section_lma (objfile->obfd, osect->the_bfd_section);
- size = bfd_get_section_size (osect->the_bfd_section);
- name = bfd_section_name (objfile->obfd, osect->the_bfd_section);
-
- printf_filtered ("Section %s, loaded at ", name);
- fputs_filtered (paddress (gdbarch, lma), gdb_stdout);
- puts_filtered (" - ");
- fputs_filtered (paddress (gdbarch, lma + size), gdb_stdout);
- printf_filtered (", mapped at ");
- fputs_filtered (paddress (gdbarch, vma), gdb_stdout);
- puts_filtered (" - ");
- fputs_filtered (paddress (gdbarch, vma + size), gdb_stdout);
- puts_filtered ("\n");
-
- nmapped++;
- }
+ {
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ const char *name;
+ bfd_vma lma, vma;
+ int size;
+
+ vma = bfd_section_vma (objfile->obfd, osect->the_bfd_section);
+ lma = bfd_section_lma (objfile->obfd, osect->the_bfd_section);
+ size = bfd_get_section_size (osect->the_bfd_section);
+ name = bfd_section_name (objfile->obfd, osect->the_bfd_section);
+
+ printf_filtered ("Section %s, loaded at ", name);
+ fputs_filtered (paddress (gdbarch, lma), gdb_stdout);
+ puts_filtered (" - ");
+ fputs_filtered (paddress (gdbarch, lma + size), gdb_stdout);
+ printf_filtered (", mapped at ");
+ fputs_filtered (paddress (gdbarch, vma), gdb_stdout);
+ puts_filtered (" - ");
+ fputs_filtered (paddress (gdbarch, vma + size), gdb_stdout);
+ puts_filtered ("\n");
+
+ nmapped++;
+ }
+ }
if (nmapped == 0)
printf_filtered (_("No sections are mapped.\n"));
}
--
2.8.2

View File

@ -0,0 +1,86 @@
Index: gdb-7.6.1/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.1/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp 2016-03-10 22:31:31.152094080 +0100
@@ -0,0 +1,43 @@
+# Copyright (C) 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if { [prepare_for_testing rhbz1261564-aarch64-watchpoint.exp "rhbz1261564-aarch64-watchpoint"] } {
+ return -1
+}
+
+if { ! [ runto main ] } then { return 0 }
+
+gdb_test "rwatch aligned.var4" "Hardware read watchpoint \[0-9\]+: aligned.var4"
+
+proc checkvar { address } {
+ global gdb_prompt
+
+ set test "p &aligned.var$address"
+ gdb_test_multiple $test $test {
+ -re " = \\(int \\*\\) 0x\[0-9a-f\]+$address <aligned(\\+\[0-9\]+)?>\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "\r\n$gdb_prompt $" {
+ untested "$test (unexpected ELF layout)"
+ return 0
+ }
+ }
+ return 1
+}
+if ![checkvar "0"] { return }
+if ![checkvar "4"] { return }
+if ![checkvar "8"] { return }
+
+gdb_continue_to_end
Index: gdb-7.6.1/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.6.1/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c 2016-03-10 22:31:31.152094080 +0100
@@ -0,0 +1,33 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2016 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+__attribute__((aligned(16))) struct
+{
+ int var0, var4, var8;
+} aligned;
+
+int
+main (void)
+{
+ aligned.var0 = 1;
+ aligned.var4 = 2;
+ aligned.var8 = 3;
+
+ aligned.var4 = aligned.var0;
+
+ return 0;
+}

View File

@ -0,0 +1,158 @@
--- /dev/null 2016-04-19 22:52:19.405224269 +0200
+++ gdb-7.6.1/gdb/testsuite/gdb.python/py-framefilter-thread.exp 2016-04-19 23:22:10.655271756 +0200
@@ -0,0 +1,54 @@
+# Copyright (C) 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib gdb-python.exp
+
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug pthreads}]} {
+ return -1
+}
+
+# Skip all tests if Python scripting is not enabled.
+if { [skip_python_tests] } { continue }
+
+if ![runto_main] then {
+ return
+}
+gdb_test_no_output "set python print-stack full" \
+ "Set python print-stack to full"
+
+# Load global frame-filters
+set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
+gdb_test_no_output "python execfile ('${remote_python_file}')" \
+ "Load python file"
+
+gdb_breakpoint [gdb_get_line_number "Backtrace end breakpoint"]
+gdb_continue_to_breakpoint "Backtrace end breakpoint"
+
+# #2 0x00007ffff75f228d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113^M
+gdb_test "bt no-filters" " in (\\.?_*clone|thread_start) \[^\r\n\]*" "bt no-filters"
+
+# #2 0x00007ffff75f228d in 941595343737041 () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113^M
+# vs.
+# #2 0x00007ffff75f228d in 941595343737041Traceback (most recent call last):
+# File "/home/jkratoch/redhat/rhel/gdb/rhel-7.3/gdb-7.6.1/gdb/testsuite/../data-directory/python/gdb/FrameDecorator.py", line 145, in frame_args
+# return self._base.frame_args()
+# File "/home/jkratoch/redhat/rhel/gdb/rhel-7.3/gdb-7.6.1/gdb/testsuite/../data-directory/python/gdb/FrameDecorator.py", line 152, in frame_args
+# return args.fetch_frame_args()
+# File "/home/jkratoch/redhat/rhel/gdb/rhel-7.3/gdb-7.6.1/gdb/testsuite/../data-directory/python/gdb/FrameDecorator.py", line 276, in fetch_frame_args
+# block = self.frame.block()
+# RuntimeError: Cannot locate object file for block.
+gdb_test "bt" " in \[0-9\]+ \[^\r\n\]*" "bt with filters"
--- /dev/null 2016-04-19 22:52:19.405224269 +0200
+++ gdb-7.6.1/gdb/testsuite/gdb.python/py-framefilter-thread.c 2016-04-18 22:44:07.096613437 +0200
@@ -0,0 +1,39 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2016 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <pthread.h>
+#include <assert.h>
+
+static void *
+start (void *arg)
+{
+ return; /* Backtrace end breakpoint */
+}
+
+int
+main (void)
+{
+ pthread_t thread1;
+ int i;
+
+ i = pthread_create (&thread1, NULL, start, NULL);
+ assert (i == 0);
+ i = pthread_join (thread1, NULL);
+ assert (i == 0);
+
+ return 0;
+}
--- /dev/null 2016-04-19 22:52:19.405224269 +0200
+++ gdb-7.6.1/gdb/testsuite/gdb.python/py-framefilter-thread.py 2016-04-19 23:14:03.273994063 +0200
@@ -0,0 +1,56 @@
+# Copyright (C) 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the GDB testsuite. It tests Python-based
+# frame-filters.
+
+# This test is specifically crafted for RH BZ 1197665.
+
+import gdb
+import itertools
+from gdb.FrameDecorator import FrameDecorator
+import copy
+
+class Reverse_Function (FrameDecorator):
+
+ def __init__(self, fobj):
+ super(Reverse_Function, self).__init__(fobj)
+ self.fobj = fobj
+
+ def function (self):
+ # This function call should not fail.
+ gdb.target_charset ()
+
+ fname = str (self.fobj.function())
+ if (fname == None or fname == ""):
+ return None
+ else:
+ fname = fname[::-1]
+ return fname
+
+class FrameFilter ():
+
+ def __init__ (self):
+ self.name = "Reverse"
+ self.priority = 100
+ self.enabled = True
+ gdb.frame_filters [self.name] = self
+
+ def filter (self, frame_iter):
+ frame_iter = itertools.imap (Reverse_Function,
+ frame_iter)
+ return frame_iter
+
+FrameFilter()

View File

@ -0,0 +1,68 @@
http://sourceware.org/ml/gdb-patches/2016-04/msg00181.html
Subject: [testsuite patch] Fix 7.11 regression: gdb.dwarf2/dw2-undefined-ret-addr.exp [now with the patch]
--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
a038fa3e14a477d4d72a26c2e139fa47d2774be2 is the first bad commit
commit a038fa3e14a477d4d72a26c2e139fa47d2774be2
Author: Markus Metzger <markus.t.metzger@intel.com>
stack: check frame_unwind_caller_id
[PATCH v3 2/3] stack: check frame_unwind_caller_id
https://sourceware.org/ml/gdb-patches/2016-02/msg00363.html
Message-Id: <1455207283-12660-2-git-send-email-markus.t.metzger@intel.com>
(gdb) PASS: gdb.dwarf2/dw2-undefined-ret-addr.exp: up refuses to go up
info frame
Stack level 0, frame at 0x0:
- rip = 0x40059a in stop_frame (dw2-undefined-ret-addr.c:22); saved rip = <not saved>
+ rip = 0x40059a in stop_frame (dw2-undefined-ret-addr.c:22); saved rip = <unavailable>
Outermost frame: outermost
source language c.
Arglist at 0x7fffffffd610, args:
Locals at 0x7fffffffd610, Previous frame's sp is 0x7fffffffd620
Saved registers:
rbp at 0x7fffffffd610
-(gdb) PASS: gdb.dwarf2/dw2-undefined-ret-addr.exp: info frame
+(gdb) FAIL: gdb.dwarf2/dw2-undefined-ret-addr.exp: info frame
It happens on normal native Fedora 23 x86_64.
I am not completely sure about the reasons but it looks to me GDB behavior has
just changed.
OK for check-in?
Thanks,
Jan
--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename=1
gdb/testsuite/ChangeLog
2016-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-undefined-ret-addr.exp: Expect <unavailable>.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
index c666584..e43054b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
@@ -48,7 +48,7 @@ gdb_test "up" \
# doesn't cause an error, and shows "<not saved>".
gdb_test "info frame" [multi_line \
"Stack level 0, frame at $hex\:" \
- " rip = $hex in stop_frame \\(dw2-undefined-ret-addr\\.c:22\\); saved rip = <not saved>" \
+ " rip = $hex in stop_frame \\(dw2-undefined-ret-addr\\.c:22\\); saved rip = <unavailable>" \
" Outermost frame: outermost" \
" source language c\\." \
" Arglist at $hex, args\: " \
--oyUTqETQ0mS9luUI--

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Jun 20 16:36:04 UTC 2016 - matz@suse.com
- Rebase to gdb 7.11.1: minor bug fixes.
- Remove gdb-gcc6-Wparentheses-warning.patch (applied upstream).
- Add some patches from Fedora F24:
gdb-bare-DW_TAG_lexical_block-1of2.patch
gdb-bare-DW_TAG_lexical_block-2of2.patch
gdb-bz1219747-attach-kills.patch
gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
gdb-rhbz1325795-framefilters-test.patch
gdb-testsuite-dw2-undefined-ret-addr.patch
-------------------------------------------------------------------
Tue May 24 10:49:47 UTC 2016 - martin.liska@suse.com

View File

@ -27,7 +27,7 @@ Name: gdb
%global snap 20130731
# See timestamp of source gnulib installed into gdb/gnulib/ .
%global snapgnulib 20121213
Version: 7.11
Version: 7.11.1
Release: 0
# The release always contains a leading reserved number, start it at 1.
@ -200,14 +200,20 @@ Patch106: gdb-btrobust.patch
Patch107: gdb-fortran-frame-string.patch
Patch108: gdb-python-gil.patch
Patch109: gdb-jit-reader-multilib.patch
Patch110: gdb-fedora-libncursesw.patch
Patch111: gdb-opcodes-clflushopt-test.patch
Patch112: gdb-dts-rhel6-python-compat.patch
Patch113: gdb-6.6-buildid-locate-rpm-scl.patch
Patch114: gdb-readline62-ask-more-rh.patch
Patch115: gdb-6.8-attach-signalled-detach-stopped.patch
Patch116: gdb-6.8-quit-never-aborts.patch
Patch117: gdb-testsuite-readline63-sigint.patch
Patch110: gdb-bz1219747-attach-kills.patch
Patch111: gdb-fedora-libncursesw.patch
Patch112: gdb-opcodes-clflushopt-test.patch
Patch113: gdb-dts-rhel6-python-compat.patch
Patch114: gdb-6.6-buildid-locate-rpm-scl.patch
Patch115: gdb-readline62-ask-more-rh.patch
Patch116: gdb-6.8-attach-signalled-detach-stopped.patch
Patch117: gdb-6.8-quit-never-aborts.patch
Patch118: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch120: gdb-testsuite-dw2-undefined-ret-addr.patch
Patch121: gdb-rhbz1325795-framefilters-test.patch
Patch122: gdb-bare-DW_TAG_lexical_block-1of2.patch
Patch123: gdb-bare-DW_TAG_lexical_block-2of2.patch
Patch124: gdb-testsuite-readline63-sigint.patch
#Fedora Packages end
# Upstream patch to fix gcc -Werror
@ -215,7 +221,6 @@ Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
Patch1003: gdb-pahole-python2.patch
Patch1004: gdb-fix-buf-overflow.diff
Patch1005: gdb-7.10-swo18929.patch
Patch1006: gdb-gcc6-Wparentheses-warning.patch
BuildRequires: bison
BuildRequires: flex
@ -467,10 +472,7 @@ find -name "*.info*"|xargs rm -f
%patch107 -p1
%patch108 -p1
%patch109 -p1
%if 0
# disable, openSUSE doesn't need it
%patch110 -p1
%endif
%patch111 -p1
%patch112 -p1
%patch113 -p1
@ -478,13 +480,18 @@ find -name "*.info*"|xargs rm -f
%patch115 -p1
%patch116 -p1
%patch117 -p1
%patch118 -p1
%patch120 -p1
%patch121 -p1
%patch122 -p1
%patch123 -p1
%patch124 -p1
#Fedora patching end
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
find -name "*.orig" | xargs rm -f
! find -name "*.rej" # Should not happen.

View File

@ -8,7 +8,7 @@ chomp($dir);
system "rm \$(grep \"^Patch[0-9]\\{1,3\\}:\" gdb.spec | cut -d\" \" -f 2) 2>/dev/null";
system "rm *.tar.bz2";
system "cp $gdbFedora/*.tar.bz2 ./";
system "cp -p $gdbFedora/*.tar.bz2 ./";
system "pushd $gdbFedora ; sh $dir/patchname_get.sh -v gdb.spec 2>$dir/test.txt; popd";
system "grep \"^Patch\" test.txt > test2.txt";