Compare commits
1 Commits
Author | SHA256 | Date | |
---|---|---|---|
f71a3fc927 |
50
aarch64-avoid-initializers-for-vlas.patch
Normal file
50
aarch64-avoid-initializers-for-vlas.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From 0f363ed540fef466f45eab4570c23853e1f14898 Mon Sep 17 00:00:00 2001
|
||||
From: Roland McGrath <mcgrathr@google.com>
|
||||
Date: Thu, 9 Feb 2023 10:47:17 -0800
|
||||
Subject: [PATCH] [aarch64] Avoid initializers for VLAs
|
||||
|
||||
Clang doesn't accept initializer syntax for variable-length
|
||||
arrays in C. Just use memset instead.
|
||||
---
|
||||
gdb/aarch64-linux-nat.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
|
||||
index e4158236db2..ecb2eeb9540 100644
|
||||
--- a/gdb/aarch64-linux-nat.c
|
||||
+++ b/gdb/aarch64-linux-nat.c
|
||||
@@ -56,6 +56,8 @@
|
||||
|
||||
#include "nat/aarch64-mte-linux-ptrace.h"
|
||||
|
||||
+#include <string.h>
|
||||
+
|
||||
#ifndef TRAP_HWBKPT
|
||||
#define TRAP_HWBKPT 0x0004
|
||||
#endif
|
||||
@@ -445,7 +447,9 @@ fetch_tlsregs_from_thread (struct regcache *regcache)
|
||||
gdb_assert (regno != -1);
|
||||
gdb_assert (tdep->tls_register_count > 0);
|
||||
|
||||
- uint64_t tpidrs[tdep->tls_register_count] = { 0 };
|
||||
+ uint64_t tpidrs[tdep->tls_register_count];
|
||||
+ memset(tpidrs, 0, sizeof(tpidrs));
|
||||
+
|
||||
struct iovec iovec;
|
||||
iovec.iov_base = tpidrs;
|
||||
iovec.iov_len = sizeof (tpidrs);
|
||||
@@ -471,7 +475,8 @@ store_tlsregs_to_thread (struct regcache *regcache)
|
||||
gdb_assert (regno != -1);
|
||||
gdb_assert (tdep->tls_register_count > 0);
|
||||
|
||||
- uint64_t tpidrs[tdep->tls_register_count] = { 0 };
|
||||
+ uint64_t tpidrs[tdep->tls_register_count];
|
||||
+ memset(tpidrs, 0, sizeof(tpidrs));
|
||||
|
||||
for (int i = 0; i < tdep->tls_register_count; i++)
|
||||
{
|
||||
|
||||
base-commit: a39101060cdf2ee239833106fb3bdf9585f858aa
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -1,100 +0,0 @@
|
||||
From 89cf6ba4a207f5342db58d9e43178ae516cc220e Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Wed, 15 Jan 2025 17:02:00 +0100
|
||||
Subject: [PATCH 23/46] Add dwarf_expr_piece.op
|
||||
|
||||
Add a new field "dwarf_location_atom op" to dwarf_expr_piece to keep track of
|
||||
which dwarf_location_atom caused a dwarf_expr_piece to be added.
|
||||
|
||||
This is used in the following patch.
|
||||
|
||||
Tested on s390x-linux.
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
---
|
||||
gdb/dwarf2/expr.c | 10 ++++++----
|
||||
gdb/dwarf2/expr.h | 6 +++++-
|
||||
2 files changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
|
||||
index cb80dbf60b1..03107f90575 100644
|
||||
--- a/gdb/dwarf2/expr.c
|
||||
+++ b/gdb/dwarf2/expr.c
|
||||
@@ -1198,13 +1198,15 @@ dwarf_expr_context::stack_empty_p () const
|
||||
|
||||
/* Add a new piece to the dwarf_expr_context's piece list. */
|
||||
void
|
||||
-dwarf_expr_context::add_piece (ULONGEST size, ULONGEST offset)
|
||||
+dwarf_expr_context::add_piece (ULONGEST size, ULONGEST offset,
|
||||
+ enum dwarf_location_atom op)
|
||||
{
|
||||
dwarf_expr_piece &p = this->m_pieces.emplace_back ();
|
||||
|
||||
p.location = this->m_location;
|
||||
p.size = size;
|
||||
p.offset = offset;
|
||||
+ p.op = op;
|
||||
|
||||
if (p.location == DWARF_VALUE_LITERAL)
|
||||
{
|
||||
@@ -2169,7 +2171,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
|
||||
|
||||
/* Record the piece. */
|
||||
op_ptr = safe_read_uleb128 (op_ptr, op_end, &size);
|
||||
- add_piece (8 * size, 0);
|
||||
+ add_piece (8 * size, 0, op);
|
||||
|
||||
/* Pop off the address/regnum, and reset the location
|
||||
type. */
|
||||
@@ -2187,7 +2189,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
|
||||
/* Record the piece. */
|
||||
op_ptr = safe_read_uleb128 (op_ptr, op_end, &size);
|
||||
op_ptr = safe_read_uleb128 (op_ptr, op_end, &uleb_offset);
|
||||
- add_piece (size, uleb_offset);
|
||||
+ add_piece (size, uleb_offset, op);
|
||||
|
||||
/* Pop off the address/regnum, and reset the location
|
||||
type. */
|
||||
@@ -2389,7 +2391,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
|
||||
pointer, then make a pieced value. This is ok because we can't
|
||||
have implicit pointers in contexts where pieces are invalid. */
|
||||
if (this->m_location == DWARF_VALUE_IMPLICIT_POINTER)
|
||||
- add_piece (8 * this->m_addr_size, 0);
|
||||
+ add_piece (8 * this->m_addr_size, 0, DW_OP_implicit_pointer);
|
||||
|
||||
this->m_recursion_depth--;
|
||||
gdb_assert (this->m_recursion_depth >= 0);
|
||||
diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h
|
||||
index b02cc531640..957c58f30c4 100644
|
||||
--- a/gdb/dwarf2/expr.h
|
||||
+++ b/gdb/dwarf2/expr.h
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "leb128.h"
|
||||
#include "dwarf2/call-site.h"
|
||||
+#include "dwarf2.h"
|
||||
|
||||
struct dwarf2_per_objfile;
|
||||
|
||||
@@ -54,6 +55,9 @@ enum dwarf_value_location
|
||||
/* A piece of an object, as recorded by DW_OP_piece or DW_OP_bit_piece. */
|
||||
struct dwarf_expr_piece
|
||||
{
|
||||
+ /* The DWARF operation for which the piece was created. */
|
||||
+ enum dwarf_location_atom op;
|
||||
+
|
||||
enum dwarf_value_location location;
|
||||
|
||||
union
|
||||
@@ -208,7 +212,7 @@ struct dwarf_expr_context
|
||||
struct type *address_type () const;
|
||||
void push (struct value *value, bool in_stack_memory);
|
||||
bool stack_empty_p () const;
|
||||
- void add_piece (ULONGEST size, ULONGEST offset);
|
||||
+ void add_piece (ULONGEST size, ULONGEST offset, enum dwarf_location_atom op);
|
||||
void execute_stack_op (const gdb_byte *op_ptr, const gdb_byte *op_end);
|
||||
void pop ();
|
||||
struct value *fetch (int n);
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,222 +0,0 @@
|
||||
From 60f9e60b8d92e20277026ee4ad5fdc71b2bbe09d Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Wed, 15 Jan 2025 17:02:00 +0100
|
||||
Subject: [PATCH] [gdb] Add gdbarch_dwarf2_reg_piece_offset hook
|
||||
|
||||
In rw_pieced_value, when reading/writing part of a register, DW_OP_piece and
|
||||
DW_OP_bit_piece are handled the same, but the standard tells us:
|
||||
- DW_OP_piece: if the piece is located in a register, but does not occupy the
|
||||
entire register, the placement of the piece within that register is defined
|
||||
by the ABI.
|
||||
- DW_OP_bit_piece: if the location is a register, the offset is from the least
|
||||
significant bit end of the register.
|
||||
|
||||
Add a new hook gdbarch_dwarf2_reg_piece_offset that allows us to define the
|
||||
ABI-specific behaviour for DW_OP_piece.
|
||||
|
||||
The default implementation of the hook is the behaviour of DW_OP_bit_piece, so
|
||||
there should not be any functional changes.
|
||||
|
||||
Tested on s390x-linux.
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
---
|
||||
gdb/dwarf2/expr.c | 31 +++++++++++++++++++++++++------
|
||||
gdb/findvar.c | 18 ++++++++++++++++++
|
||||
gdb/gdbarch-gen.c | 22 ++++++++++++++++++++++
|
||||
gdb/gdbarch-gen.h | 8 ++++++++
|
||||
gdb/gdbarch_components.py | 16 ++++++++++++++++
|
||||
gdb/value.h | 2 ++
|
||||
6 files changed, 91 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
|
||||
index 2a1b85147d3..ee1522b7437 100644
|
||||
--- a/gdb/dwarf2/expr.c
|
||||
+++ b/gdb/dwarf2/expr.c
|
||||
@@ -211,14 +211,33 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
|
||||
ULONGEST reg_bits = 8 * register_size (arch, gdb_regnum);
|
||||
int optim, unavail;
|
||||
|
||||
- if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
|
||||
- && p->offset + p->size < reg_bits)
|
||||
+ if (p->offset + p->size < reg_bits)
|
||||
{
|
||||
- /* Big-endian, and we want less than full size. */
|
||||
- bits_to_skip += reg_bits - (p->offset + p->size);
|
||||
+ /* We want less than full size. */
|
||||
+
|
||||
+ if (p->op == DW_OP_piece)
|
||||
+ {
|
||||
+ gdb_assert (p->offset == 0);
|
||||
+
|
||||
+ /* If the piece is located in a register, but does not
|
||||
+ occupy the entire register, the placement of the piece
|
||||
+ within that register is defined by the ABI. */
|
||||
+ bits_to_skip
|
||||
+ += 8 * gdbarch_dwarf2_reg_piece_offset (arch, gdb_regnum,
|
||||
+ p->size / 8);
|
||||
+ }
|
||||
+ else if (p->op == DW_OP_bit_piece)
|
||||
+ {
|
||||
+ /* If the location is a register, the offset is from the
|
||||
+ least significant bit end of the register. */
|
||||
+ if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
|
||||
+ bits_to_skip += reg_bits - (p->offset + p->size);
|
||||
+ else
|
||||
+ bits_to_skip += p->offset;
|
||||
+ }
|
||||
+ else
|
||||
+ error (_("Don't know how to get part of implicit pointer"));
|
||||
}
|
||||
- else
|
||||
- bits_to_skip += p->offset;
|
||||
|
||||
this_size = bits_to_bytes (bits_to_skip, this_size_bits);
|
||||
buffer.resize (this_size);
|
||||
diff --git a/gdb/findvar.c b/gdb/findvar.c
|
||||
index f7760aa61ca..1a9d2bedfc2 100644
|
||||
--- a/gdb/findvar.c
|
||||
+++ b/gdb/findvar.c
|
||||
@@ -541,6 +541,24 @@ default_value_from_register (gdbarch *gdbarch, type *type, int regnum,
|
||||
return value;
|
||||
}
|
||||
|
||||
+/* Default implementation of gdbarch_dwarf2_reg_piece_offset. Implements
|
||||
+ DW_OP_bits_piece for DW_OP_piece. */
|
||||
+
|
||||
+ULONGEST
|
||||
+default_dwarf2_reg_piece_offset (gdbarch *gdbarch, int gdb_regnum, ULONGEST size)
|
||||
+{
|
||||
+ ULONGEST reg_size = register_size (gdbarch, gdb_regnum);
|
||||
+ gdb_assert (size <= reg_size);
|
||||
+ if (reg_size == size)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
|
||||
+ return reg_size - size;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* VALUE must be an lval_register value. If regnum is the value's
|
||||
associated register number, and len the length of the value's type,
|
||||
read one or more registers in VALUE's frame, starting with register REGNUM,
|
||||
diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c
|
||||
index efc784c2311..8137ece78bc 100644
|
||||
--- a/gdb/gdbarch-gen.c
|
||||
+++ b/gdb/gdbarch-gen.c
|
||||
@@ -109,6 +109,7 @@ struct gdbarch
|
||||
gdbarch_register_to_value_ftype *register_to_value = nullptr;
|
||||
gdbarch_value_to_register_ftype *value_to_register = nullptr;
|
||||
gdbarch_value_from_register_ftype *value_from_register = default_value_from_register;
|
||||
+ gdbarch_dwarf2_reg_piece_offset_ftype *dwarf2_reg_piece_offset = default_dwarf2_reg_piece_offset;
|
||||
gdbarch_pointer_to_address_ftype *pointer_to_address = unsigned_pointer_to_address;
|
||||
gdbarch_address_to_pointer_ftype *address_to_pointer = unsigned_address_to_pointer;
|
||||
gdbarch_integer_to_address_ftype *integer_to_address = nullptr;
|
||||
@@ -372,6 +373,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
|
||||
/* Skip verify of register_to_value, invalid_p == 0. */
|
||||
/* Skip verify of value_to_register, invalid_p == 0. */
|
||||
/* Skip verify of value_from_register, invalid_p == 0. */
|
||||
+ /* Skip verify of dwarf2_reg_piece_offset, invalid_p == 0. */
|
||||
/* Skip verify of pointer_to_address, invalid_p == 0. */
|
||||
/* Skip verify of address_to_pointer, invalid_p == 0. */
|
||||
/* Skip verify of integer_to_address, has predicate. */
|
||||
@@ -789,6 +791,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
||||
gdb_printf (file,
|
||||
"gdbarch_dump: value_from_register = <%s>\n",
|
||||
host_address_to_string (gdbarch->value_from_register));
|
||||
+ gdb_printf (file,
|
||||
+ "gdbarch_dump: dwarf2_reg_piece_offset = <%s>\n",
|
||||
+ host_address_to_string (gdbarch->dwarf2_reg_piece_offset));
|
||||
gdb_printf (file,
|
||||
"gdbarch_dump: pointer_to_address = <%s>\n",
|
||||
host_address_to_string (gdbarch->pointer_to_address));
|
||||
@@ -2588,6 +2593,23 @@ set_gdbarch_value_from_register (struct gdbarch *gdbarch,
|
||||
gdbarch->value_from_register = value_from_register;
|
||||
}
|
||||
|
||||
+ULONGEST
|
||||
+gdbarch_dwarf2_reg_piece_offset (struct gdbarch *gdbarch, int regnum, ULONGEST size)
|
||||
+{
|
||||
+ gdb_assert (gdbarch != NULL);
|
||||
+ gdb_assert (gdbarch->dwarf2_reg_piece_offset != NULL);
|
||||
+ if (gdbarch_debug >= 2)
|
||||
+ gdb_printf (gdb_stdlog, "gdbarch_dwarf2_reg_piece_offset called\n");
|
||||
+ return gdbarch->dwarf2_reg_piece_offset (gdbarch, regnum, size);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+set_gdbarch_dwarf2_reg_piece_offset (struct gdbarch *gdbarch,
|
||||
+ gdbarch_dwarf2_reg_piece_offset_ftype dwarf2_reg_piece_offset)
|
||||
+{
|
||||
+ gdbarch->dwarf2_reg_piece_offset = dwarf2_reg_piece_offset;
|
||||
+}
|
||||
+
|
||||
CORE_ADDR
|
||||
gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
|
||||
{
|
||||
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
|
||||
index 9627f6d6a9f..abffcf99fac 100644
|
||||
--- a/gdb/gdbarch-gen.h
|
||||
+++ b/gdb/gdbarch-gen.h
|
||||
@@ -430,6 +430,14 @@ typedef struct value * (gdbarch_value_from_register_ftype) (struct gdbarch *gdba
|
||||
extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, const frame_info_ptr &this_frame);
|
||||
extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_value_from_register_ftype *value_from_register);
|
||||
|
||||
+/* For a DW_OP_piece located in a register, but not occupying the
|
||||
+ entire register, return the placement of the piece within that
|
||||
+ register as defined by the ABI. */
|
||||
+
|
||||
+typedef ULONGEST (gdbarch_dwarf2_reg_piece_offset_ftype) (struct gdbarch *gdbarch, int regnum, ULONGEST size);
|
||||
+extern ULONGEST gdbarch_dwarf2_reg_piece_offset (struct gdbarch *gdbarch, int regnum, ULONGEST size);
|
||||
+extern void set_gdbarch_dwarf2_reg_piece_offset (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_piece_offset_ftype *dwarf2_reg_piece_offset);
|
||||
+
|
||||
typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
|
||||
extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
|
||||
extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address);
|
||||
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
|
||||
index f9c18365add..2d528de2c56 100644
|
||||
--- a/gdb/gdbarch_components.py
|
||||
+++ b/gdb/gdbarch_components.py
|
||||
@@ -829,6 +829,22 @@ allocate and return a struct value with all value attributes
|
||||
invalid=False,
|
||||
)
|
||||
|
||||
+Method(
|
||||
+ comment="""
|
||||
+For a DW_OP_piece located in a register, but not occupying the
|
||||
+entire register, return the placement of the piece within that
|
||||
+register as defined by the ABI.
|
||||
+""",
|
||||
+ type="ULONGEST",
|
||||
+ name="dwarf2_reg_piece_offset",
|
||||
+ params=[
|
||||
+ ("int", "regnum"),
|
||||
+ ("ULONGEST", "size")
|
||||
+ ],
|
||||
+ predefault="default_dwarf2_reg_piece_offset",
|
||||
+ invalid=False,
|
||||
+)
|
||||
+
|
||||
Method(
|
||||
type="CORE_ADDR",
|
||||
name="pointer_to_address",
|
||||
diff --git a/gdb/value.h b/gdb/value.h
|
||||
index 2c94e09cbf3..8e5fd5403cc 100644
|
||||
--- a/gdb/value.h
|
||||
+++ b/gdb/value.h
|
||||
@@ -1128,6 +1128,8 @@ extern value *default_value_from_register (gdbarch *gdbarch, type *type,
|
||||
int regnum,
|
||||
const frame_info_ptr &this_frame);
|
||||
|
||||
+extern ULONGEST default_dwarf2_reg_piece_offset (gdbarch *gdbarch, int regnum, ULONGEST size);
|
||||
+
|
||||
extern struct value *value_from_register (struct type *type, int regnum,
|
||||
const frame_info_ptr &frame);
|
||||
|
||||
|
||||
base-commit: 82b53ea8aa8bb7fa481e742d5050e0adef8b2d58
|
||||
--
|
||||
2.43.0
|
||||
|
202
avoid-manual-memory-management-in-go-lang.c.patch
Normal file
202
avoid-manual-memory-management-in-go-lang.c.patch
Normal file
@@ -0,0 +1,202 @@
|
||||
From 4e0e7ff14ba271576232160bf337639662a2ea23 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Tromey <tom@tromey.com>
|
||||
Date: Thu, 16 Feb 2023 17:36:29 -0700
|
||||
Subject: [PATCH 2/3] Avoid manual memory management in go-lang.c
|
||||
|
||||
I noticed a couple of spots in go-lang.c that could be improved by
|
||||
using unique_ptr.
|
||||
|
||||
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
|
||||
---
|
||||
gdb/dwarf2/read.c | 2 +-
|
||||
gdb/go-exp.c | 287 +++++++++++++++++++++++-----------------------
|
||||
gdb/go-exp.y | 8 +-
|
||||
gdb/go-lang.c | 40 +++----
|
||||
gdb/go-lang.h | 11 +-
|
||||
5 files changed, 173 insertions(+), 175 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
index 8aa7f8c31e5..61f4bd75013 100644
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -7890,7 +7890,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
|
||||
&& sym->aclass () == LOC_BLOCK)
|
||||
{
|
||||
gdb::unique_xmalloc_ptr<char> this_package_name
|
||||
- (go_symbol_package_name (sym));
|
||||
+ = go_symbol_package_name (sym);
|
||||
|
||||
if (this_package_name == NULL)
|
||||
continue;
|
||||
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
|
||||
index cbaa79ee18c..542a06d06d6 100644
|
||||
--- a/gdb/go-exp.y
|
||||
+++ b/gdb/go-exp.y
|
||||
@@ -1393,16 +1393,16 @@ classify_name (struct parser_state *par_state, const struct block *block)
|
||||
current package. */
|
||||
|
||||
{
|
||||
- char *current_package_name = go_block_package_name (block);
|
||||
+ gdb::unique_xmalloc_ptr<char> current_package_name
|
||||
+ = go_block_package_name (block);
|
||||
|
||||
if (current_package_name != NULL)
|
||||
{
|
||||
struct stoken sval =
|
||||
- build_packaged_name (current_package_name,
|
||||
- strlen (current_package_name),
|
||||
+ build_packaged_name (current_package_name.get (),
|
||||
+ strlen (current_package_name.get ()),
|
||||
copy.c_str (), copy.size ());
|
||||
|
||||
- xfree (current_package_name);
|
||||
sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN,
|
||||
&is_a_field_of_this);
|
||||
if (sym.symbol)
|
||||
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
|
||||
index 7549f14dc63..f9176ace71d 100644
|
||||
--- a/gdb/go-lang.c
|
||||
+++ b/gdb/go-lang.c
|
||||
@@ -163,11 +163,8 @@ unpack_package_and_object (char *buf,
|
||||
|
||||
Space for the resulting strings is malloc'd in one buffer.
|
||||
PACKAGEP,OBJECTP,METHOD_TYPE* will (typically) point into this buffer.
|
||||
- [There are a few exceptions, but the caller is still responsible for
|
||||
- freeing the resulting pointer.]
|
||||
A pointer to this buffer is returned, or NULL if symbol isn't a
|
||||
mangled Go symbol.
|
||||
- The caller is responsible for freeing the result.
|
||||
|
||||
*METHOD_TYPE_IS_POINTERP is set to a boolean indicating if
|
||||
the method type is a pointer.
|
||||
@@ -180,7 +177,7 @@ unpack_package_and_object (char *buf,
|
||||
If we ever need to unpack the method type, this routine should work
|
||||
for that too. */
|
||||
|
||||
-static char *
|
||||
+static gdb::unique_xmalloc_ptr<char>
|
||||
unpack_mangled_go_symbol (const char *mangled_name,
|
||||
const char **packagep,
|
||||
const char **objectp,
|
||||
@@ -209,9 +206,10 @@ unpack_mangled_go_symbol (const char *mangled_name,
|
||||
/* main.init is mangled specially. */
|
||||
if (strcmp (mangled_name, "__go_init_main") == 0)
|
||||
{
|
||||
- char *package = xstrdup ("main");
|
||||
+ gdb::unique_xmalloc_ptr<char> package
|
||||
+ = make_unique_xstrdup ("main");
|
||||
|
||||
- *packagep = package;
|
||||
+ *packagep = package.get ();
|
||||
*objectp = "init";
|
||||
return package;
|
||||
}
|
||||
@@ -219,9 +217,10 @@ unpack_mangled_go_symbol (const char *mangled_name,
|
||||
/* main.main is mangled specially (missing prefix). */
|
||||
if (strcmp (mangled_name, "main.main") == 0)
|
||||
{
|
||||
- char *package = xstrdup ("main");
|
||||
+ gdb::unique_xmalloc_ptr<char> package
|
||||
+ = make_unique_xstrdup ("main");
|
||||
|
||||
- *packagep = package;
|
||||
+ *packagep = package.get ();
|
||||
*objectp = "main";
|
||||
return package;
|
||||
}
|
||||
@@ -261,7 +260,8 @@ unpack_mangled_go_symbol (const char *mangled_name,
|
||||
|
||||
/* At this point we've decided we have a mangled Go symbol. */
|
||||
|
||||
- buf = xstrdup (mangled_name);
|
||||
+ gdb::unique_xmalloc_ptr<char> result = make_unique_xstrdup (mangled_name);
|
||||
+ buf = result.get ();
|
||||
|
||||
/* Search backwards looking for "N<digit(s)>". */
|
||||
p = buf + len;
|
||||
@@ -317,7 +317,7 @@ unpack_mangled_go_symbol (const char *mangled_name,
|
||||
}
|
||||
|
||||
unpack_package_and_object (buf, packagep, objectp);
|
||||
- return buf;
|
||||
+ return result;
|
||||
}
|
||||
|
||||
/* Implements the la_demangle language_defn routine for language Go.
|
||||
@@ -381,10 +381,9 @@ go_language::demangle_symbol (const char *mangled_name, int options) const
|
||||
return make_unique_xstrdup ((const char *) obstack_finish (&tempbuf));
|
||||
}
|
||||
|
||||
-/* Given a Go symbol, return its package or NULL if unknown.
|
||||
- Space for the result is malloc'd, caller must free. */
|
||||
+/* See go-lang.h. */
|
||||
|
||||
-char *
|
||||
+gdb::unique_xmalloc_ptr<char>
|
||||
go_symbol_package_name (const struct symbol *sym)
|
||||
{
|
||||
const char *mangled_name = sym->linkage_name ();
|
||||
@@ -393,8 +392,7 @@ go_symbol_package_name (const struct symbol *sym)
|
||||
const char *method_type_package_name;
|
||||
const char *method_type_object_name;
|
||||
int method_type_is_pointer;
|
||||
- char *name_buf;
|
||||
- char *result;
|
||||
+ gdb::unique_xmalloc_ptr<char> name_buf;
|
||||
|
||||
gdb_assert (sym->language () == language_go);
|
||||
name_buf = unpack_mangled_go_symbol (mangled_name,
|
||||
@@ -405,15 +403,12 @@ go_symbol_package_name (const struct symbol *sym)
|
||||
/* Some Go symbols don't have mangled form we interpret (yet). */
|
||||
if (name_buf == NULL)
|
||||
return NULL;
|
||||
- result = xstrdup (package_name);
|
||||
- xfree (name_buf);
|
||||
- return result;
|
||||
+ return make_unique_xstrdup (package_name);
|
||||
}
|
||||
|
||||
-/* Return the package that BLOCK is in, or NULL if there isn't one.
|
||||
- Space for the result is malloc'd, caller must free. */
|
||||
+/* See go-lang.h. */
|
||||
|
||||
-char *
|
||||
+gdb::unique_xmalloc_ptr<char>
|
||||
go_block_package_name (const struct block *block)
|
||||
{
|
||||
while (block != NULL)
|
||||
@@ -422,7 +417,8 @@ go_block_package_name (const struct block *block)
|
||||
|
||||
if (function != NULL)
|
||||
{
|
||||
- char *package_name = go_symbol_package_name (function);
|
||||
+ gdb::unique_xmalloc_ptr<char> package_name
|
||||
+ = go_symbol_package_name (function);
|
||||
|
||||
if (package_name != NULL)
|
||||
return package_name;
|
||||
diff --git a/gdb/go-lang.h b/gdb/go-lang.h
|
||||
index f0929cc3ac5..8edfe6ed53a 100644
|
||||
--- a/gdb/go-lang.h
|
||||
+++ b/gdb/go-lang.h
|
||||
@@ -62,9 +62,14 @@ extern const char *go_main_name (void);
|
||||
|
||||
extern enum go_type go_classify_struct_type (struct type *type);
|
||||
|
||||
-extern char *go_symbol_package_name (const struct symbol *sym);
|
||||
-
|
||||
-extern char *go_block_package_name (const struct block *block);
|
||||
+/* Given a Go symbol, return its package or nullptr if unknown. */
|
||||
+extern gdb::unique_xmalloc_ptr<char> go_symbol_package_name
|
||||
+ (const struct symbol *sym);
|
||||
+
|
||||
+/* Return the package that BLOCK is in, or nullptr if there isn't
|
||||
+ one. */
|
||||
+extern gdb::unique_xmalloc_ptr<char> go_block_package_name
|
||||
+ (const struct block *block);
|
||||
|
||||
extern const struct builtin_go_type *builtin_go_type (struct gdbarch *);
|
||||
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -1,144 +0,0 @@
|
||||
From 0ac8e9af3cd6713f4b230e9e335e1398c3161210 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Fri, 10 Jan 2025 21:25:53 +0100
|
||||
Subject: [PATCH 26/46] Fix gdb.ada/O2_float_param.exp on s390x-linux
|
||||
|
||||
With test-case gdb.ada/O2_float_param.exp on s390x-linux, I get:
|
||||
...
|
||||
(gdb) frame^M
|
||||
#0 callee.increment (val=99.0, val@entry=<error reading variable: \
|
||||
register has not been saved in frame>, msg=...) at callee.adb:19^M
|
||||
19 procedure Increment (Val : in out Float; Msg: String) is^M
|
||||
(gdb) FAIL: $exp: scenario=all: frame
|
||||
...
|
||||
|
||||
The frame command calls read_frame_arg to get:
|
||||
- the current value of val, and
|
||||
- the value of val at function entry.
|
||||
|
||||
The first scenario succeeds, and the second scenario fails.
|
||||
|
||||
For context and contrast, let's also investigate the first scenario: getting
|
||||
the current value of val.
|
||||
|
||||
Function parameter val:
|
||||
...
|
||||
<2><b51>: Abbrev Number: 4 (DW_TAG_formal_parameter)
|
||||
<b52> DW_AT_name : val
|
||||
<b58> DW_AT_type : <0xb86>
|
||||
<b5c> DW_AT_location : 0xab (location list)
|
||||
...
|
||||
has location list:
|
||||
...
|
||||
000000ab 0000000001002928 0000000001002967
|
||||
(DW_OP_reg16 (f0))
|
||||
000000be 0000000001002967 0000000001002968
|
||||
(DW_OP_reg24 (f8))
|
||||
000000d1 0000000001002968 0000000001002974
|
||||
(DW_OP_GNU_regval_type: 24 (f8) <0xb29>;
|
||||
DW_OP_GNU_const_type: <0xb29> 4 byte block: 3f 80 0 0 ; DW_OP_plus;
|
||||
DW_OP_stack_value)
|
||||
000000ef 0000000001002974 0000000001002982
|
||||
(DW_OP_GNU_entry_value: (DW_OP_GNU_regval_type: 16 (f0) <0xb29>);
|
||||
DW_OP_GNU_const_type: <0xb29> 4 byte block: 3f 80 0 0 ; DW_OP_plus;
|
||||
DW_OP_stack_value)
|
||||
0000010f <End of list>
|
||||
...
|
||||
and since we're stopped at address 0x1002928:
|
||||
...
|
||||
(gdb) print $pc
|
||||
$1 = (access procedure) 0x1002928 <callee.increment>
|
||||
...
|
||||
we get the value from dwarf register 16.
|
||||
|
||||
The s390x ABI [1] specifies that dwarf register 16 maps onto 8-byte register
|
||||
f0 or 16-byte register v0 (where f0 is part of v0), and in this case (because
|
||||
the v0 register is available) s390_dwarf_reg_to_regnum maps it to v0.
|
||||
|
||||
Val is only 4 bytes:
|
||||
...
|
||||
(gdb) ptype val
|
||||
type = <4-byte float>
|
||||
...
|
||||
and s390_value_from_register takes care to get the value from the correct part
|
||||
of v0.
|
||||
|
||||
The value of v0 is found in the prologue cache, and the value of parameter val
|
||||
is printed.
|
||||
|
||||
Now the second scenario: getting the value of val at function entry.
|
||||
|
||||
FWIW, since we're stopped at function entry, we could simply return the same
|
||||
value, reading the same register, but that's currently not implemented [2].
|
||||
|
||||
Instead we start from the fact that val is in dwarf reg 16 at function entry,
|
||||
and then use call site information:
|
||||
...
|
||||
<4><cf7>: Abbrev Number: 13 (DW_TAG_GNU_call_site)
|
||||
<cf8> DW_AT_low_pc : 0x1002a46
|
||||
<d00> DW_AT_abstract_origin: <0xdda>
|
||||
<5><d04>: Abbrev Number: 12 (DW_TAG_GNU_call_site_parameter)
|
||||
<d05> DW_AT_location : 1 byte block: 60 (DW_OP_reg16 (f0))
|
||||
<d07> DW_AT_GNU_call_site_value: 3 byte block: f5 18 2d \
|
||||
(DW_OP_GNU_regval_type: 24 (f8) <0xc42>)
|
||||
<5><d0b>: Abbrev Number: 12 (DW_TAG_GNU_call_site_parameter)
|
||||
...
|
||||
to conclude that the value we're looking for is in dwarf reg 24, which
|
||||
s390_dwarf_reg_to_regnum maps to v8.
|
||||
|
||||
As before, s390_value_from_register takes care to get the value from the
|
||||
correct part of v8.
|
||||
|
||||
However, v8 is not available in the prologue cache, and we take a different
|
||||
path and end up in s390_unwind_pseudo_register, where v8 and similar
|
||||
(regnum_is_vxr_full) is unhandled, and we get:
|
||||
...
|
||||
return value::allocate_optimized_out (type);
|
||||
...
|
||||
which eventually causes the "error reading variable: register has not been
|
||||
saved in frame".
|
||||
|
||||
Fix this by handling the regnum_is_vxr_full case in
|
||||
s390_unwind_pseudo_register, similar to how that is done in
|
||||
s390_pseudo_register_read.
|
||||
|
||||
Tested on s390x-linux.
|
||||
|
||||
This also fixes test-case gdb.base/savedregs.exp.
|
||||
|
||||
[1] https://github.com/IBM/s390x-abi
|
||||
[2] https://sourceware.org/pipermail/gdb-patches/2024-September/211589.html
|
||||
---
|
||||
gdb/s390-tdep.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
|
||||
index a7c58b37276..31730296ef1 100644
|
||||
--- a/gdb/s390-tdep.c
|
||||
+++ b/gdb/s390-tdep.c
|
||||
@@ -2332,6 +2332,22 @@ s390_unwind_pseudo_register (const frame_info_ptr &this_frame, int regnum)
|
||||
return value_cast (type, val);
|
||||
}
|
||||
|
||||
+ if (regnum_is_vxr_full (tdep, regnum))
|
||||
+ {
|
||||
+ struct value *val = value::allocate_register (this_frame, regnum);
|
||||
+
|
||||
+ int reg = regnum - tdep->v0_full_regnum;
|
||||
+ struct value *val1
|
||||
+ = frame_unwind_register_value (this_frame, S390_F0_REGNUM + reg);
|
||||
+ struct value *val2
|
||||
+ = frame_unwind_register_value (this_frame, S390_V0_LOWER_REGNUM + reg);
|
||||
+
|
||||
+ val1->contents_copy (val, 0, 0, 8);
|
||||
+ val2->contents_copy (val, 8, 0, 8);
|
||||
+
|
||||
+ return value_cast (type, val);
|
||||
+ }
|
||||
+
|
||||
return value::allocate_optimized_out (type);
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,188 +0,0 @@
|
||||
From de696a57729423bf643e530fdb638dff6cf3c08b Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Sat, 4 Jan 2025 11:31:02 +0100
|
||||
Subject: [PATCH 21/46] Fix gdb.base/finish-pretty.exp on s390x
|
||||
|
||||
On s390x-linux, with test-case gdb.base/finish-pretty.exp I ran into:
|
||||
...
|
||||
(gdb) finish
|
||||
Run till exit from #0 foo () at finish-pretty.c:28
|
||||
main () at finish-pretty.c:40
|
||||
40 return v.a + v.b;
|
||||
Value returned has type: struct s. Cannot determine contents
|
||||
(gdb) FAIL: $exp: finish foo prettyprinted function result
|
||||
...
|
||||
|
||||
The function being finished is foo, which returns a value of type struct s.
|
||||
|
||||
The ABI [1] specifies:
|
||||
- that the value is returned in a storage buffer allocated by the caller, and
|
||||
- that the address of this buffer is passed as a hidden argument in r2.
|
||||
|
||||
GDB fails to print the value when finishing foo, because it doesn't know the
|
||||
address of the buffer.
|
||||
|
||||
Implement the gdbarch_get_return_buf_addr hook for s390x to fix this.
|
||||
|
||||
This is based on ppc_sysv_get_return_buf_addr, the only other implementation
|
||||
of gdbarch_get_return_buf_addr. For readability I've factored out
|
||||
dwarf_reg_on_entry.
|
||||
|
||||
There is one difference with ppc_sysv_get_return_buf_addr: only
|
||||
NO_ENTRY_VALUE_ERROR is caught. If this patch is approved, I intend to submit
|
||||
a follow-up patch to fix this in ppc_sysv_get_return_buf_addr as well.
|
||||
|
||||
The hook is not guaranteed to work, because it attempts to get the value r2
|
||||
had at function entry.
|
||||
|
||||
The hook can be called after function entry, and the ABI doesn't guarantee
|
||||
that r2 is the same throughout the function.
|
||||
|
||||
Using -fvar-tracking adds debug information, which allows the hook to succeed
|
||||
more often, and indeed after adding this to the test-case, it passes.
|
||||
|
||||
Do likewise in one more test-case.
|
||||
|
||||
Tested on s390x-linux.
|
||||
|
||||
Fixes:
|
||||
- gdb.ada/finish-large.exp
|
||||
- gdb.base/finish-pretty.exp
|
||||
- gdb.base/retval-large-struct.exp
|
||||
- gdb.cp/non-trivial-retval.exp
|
||||
- gdb.ada/array_return.exp
|
||||
|
||||
AFAICT, I've also enabled the hook for s390 and from the ABI I get the
|
||||
impression that it should work, but I haven't been able to test it.
|
||||
|
||||
[1] https://github.com/IBM/s390x-abi
|
||||
---
|
||||
gdb/s390-tdep.c | 58 ++++++++++++++++++++++++
|
||||
gdb/testsuite/gdb.ada/array_return.exp | 8 +++-
|
||||
gdb/testsuite/gdb.base/finish-pretty.exp | 8 +++-
|
||||
3 files changed, 72 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
|
||||
index 4844b7e9bc8..4e7dce70c12 100644
|
||||
--- a/gdb/s390-tdep.c
|
||||
+++ b/gdb/s390-tdep.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "trad-frame.h"
|
||||
#include "value.h"
|
||||
#include "inferior.h"
|
||||
+#include "dwarf2/loc.h"
|
||||
|
||||
#include "features/s390-linux32.c"
|
||||
#include "features/s390x-linux64.c"
|
||||
@@ -2119,6 +2120,62 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function,
|
||||
return rvc;
|
||||
}
|
||||
|
||||
+/* Try to get the value of DWARF_REG in FRAME at function entry. If successful,
|
||||
+ return it as value of type VAL_TYPE. */
|
||||
+
|
||||
+static struct value *
|
||||
+dwarf_reg_on_entry (int dwarf_reg, struct type *val_type,
|
||||
+ const frame_info_ptr &frame)
|
||||
+{
|
||||
+ enum call_site_parameter_kind kind = CALL_SITE_PARAMETER_DWARF_REG;
|
||||
+ union call_site_parameter_u kind_u = { .dwarf_reg = dwarf_reg };
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ return value_of_dwarf_reg_entry (val_type, frame, kind, kind_u);
|
||||
+ }
|
||||
+ catch (const gdb_exception_error &e)
|
||||
+ {
|
||||
+ if (e.error == NO_ENTRY_VALUE_ERROR)
|
||||
+ return nullptr;
|
||||
+
|
||||
+ throw;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* Both the 32-bit and 64-bit ABIs specify that values of some types are
|
||||
+ returned in a storage buffer provided by the caller. Return the address of
|
||||
+ that storage buffer, if possible. Implements the
|
||||
+ gdbarch_get_return_buf_addr hook. */
|
||||
+
|
||||
+static CORE_ADDR
|
||||
+s390_get_return_buf_addr (struct type *val_type,
|
||||
+ const frame_info_ptr &cur_frame)
|
||||
+{
|
||||
+ /* The address of the storage buffer is provided as a hidden argument in
|
||||
+ register r2. */
|
||||
+ int dwarf_reg = 2;
|
||||
+
|
||||
+ /* The ABI does not guarantee that the register will not be changed while
|
||||
+ executing the function. Hence, it cannot be assumed that it will still
|
||||
+ contain the address of the storage buffer when execution reaches the end
|
||||
+ of the function.
|
||||
+
|
||||
+ Attempt to determine the value on entry using the DW_OP_entry_value DWARF
|
||||
+ entries. This requires compiling the user program with -fvar-tracking. */
|
||||
+ struct value *val_on_entry
|
||||
+ = dwarf_reg_on_entry (dwarf_reg, lookup_pointer_type (val_type), cur_frame);
|
||||
+
|
||||
+ if (val_on_entry == nullptr)
|
||||
+ {
|
||||
+ warning ("Cannot determine the function return value.\n"
|
||||
+ "Try compiling with -fvar-tracking.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return value_as_address (val_on_entry);
|
||||
+}
|
||||
+
|
||||
/* Frame unwinding. */
|
||||
|
||||
/* Implement the stack_frame_destroyed_p gdbarch method. */
|
||||
@@ -7183,6 +7240,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
set_gdbarch_dummy_id (gdbarch, s390_dummy_id);
|
||||
set_gdbarch_frame_align (gdbarch, s390_frame_align);
|
||||
set_gdbarch_return_value (gdbarch, s390_return_value);
|
||||
+ set_gdbarch_get_return_buf_addr (gdbarch, s390_get_return_buf_addr);
|
||||
|
||||
/* Frame handling. */
|
||||
/* Stack grows downward. */
|
||||
diff --git a/gdb/testsuite/gdb.ada/array_return.exp b/gdb/testsuite/gdb.ada/array_return.exp
|
||||
index c6edee11f17..d1fc2ac2c98 100644
|
||||
--- a/gdb/testsuite/gdb.ada/array_return.exp
|
||||
+++ b/gdb/testsuite/gdb.ada/array_return.exp
|
||||
@@ -19,7 +19,13 @@ require allow_ada_tests
|
||||
|
||||
standard_ada_testfile p
|
||||
|
||||
-if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
|
||||
+set opts {}
|
||||
+lappend opts debug
|
||||
+if { [have_fvar_tracking] } {
|
||||
+ lappend opts "additional_flags=-fvar-tracking"
|
||||
+}
|
||||
+
|
||||
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $opts] != ""} {
|
||||
return -1
|
||||
}
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/finish-pretty.exp b/gdb/testsuite/gdb.base/finish-pretty.exp
|
||||
index 44f3340f41c..0b6bea6681d 100644
|
||||
--- a/gdb/testsuite/gdb.base/finish-pretty.exp
|
||||
+++ b/gdb/testsuite/gdb.base/finish-pretty.exp
|
||||
@@ -18,7 +18,13 @@
|
||||
|
||||
standard_testfile
|
||||
|
||||
-if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
|
||||
+set opts {}
|
||||
+lappend opts debug
|
||||
+if { [have_fvar_tracking] } {
|
||||
+ lappend opts "additional_flags=-fvar-tracking"
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] } {
|
||||
return -1
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,187 +0,0 @@
|
||||
From 1d761604714b32883d2bbc4a5f274fc3e2c668fe Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Thu, 9 Jan 2025 14:32:19 +0100
|
||||
Subject: [PATCH 22/46] Fix gdb.base/readnever.exp on s390x
|
||||
|
||||
On s390x-linux, I run into:
|
||||
...
|
||||
(gdb) backtrace
|
||||
#0 0x000000000100061a in fun_three ()
|
||||
#1 0x000000000100067a in fun_two ()
|
||||
#2 0x000003fffdfa9470 in ?? ()
|
||||
Backtrace stopped: frame did not save the PC
|
||||
(gdb) FAIL: gdb.base/readnever.exp: backtrace
|
||||
...
|
||||
|
||||
This is really due to a problem handling the fun_three frame. When generating
|
||||
a backtrace from fun_two, everying looks ok:
|
||||
...
|
||||
$ gdb -readnever -q -batch outputs/gdb.base/readnever/readnever \
|
||||
-ex "b fun_two" \
|
||||
-ex run \
|
||||
-ex bt
|
||||
...
|
||||
#0 0x0000000001000650 in fun_two ()
|
||||
#1 0x00000000010006b6 in fun_one ()
|
||||
#2 0x00000000010006ee in main ()
|
||||
...
|
||||
|
||||
For reference the frame info with debug info (without -readnever) looks like this:
|
||||
...
|
||||
$ gdb -q -batch outputs/gdb.base/readnever/readnever \
|
||||
-ex "b fun_three" \
|
||||
-ex run \
|
||||
-ex "info frame"
|
||||
...
|
||||
Stack level 0, frame at 0x3fffffff140:
|
||||
pc = 0x1000632 in fun_three (readnever.c:20); saved pc = 0x100067a
|
||||
called by frame at 0x3fffffff1f0
|
||||
source language c.
|
||||
Arglist at 0x3fffffff140, args: a=10, b=49 '1', c=0x3fffffff29c
|
||||
Locals at 0x3fffffff140, Previous frame's sp in v0
|
||||
...
|
||||
|
||||
But with -readnever, like this instead:
|
||||
...
|
||||
Stack level 0, frame at 0x0:
|
||||
pc = 0x100061a in fun_three; saved pc = 0x100067a
|
||||
called by frame at 0x3fffffff140
|
||||
Arglist at 0xffffffffffffffff, args:
|
||||
Locals at 0xffffffffffffffff, Previous frame's sp in r15
|
||||
...
|
||||
|
||||
An obvious difference is the "Previous frame's sp in" v0 vs. r15.
|
||||
|
||||
Looking at the code:
|
||||
...
|
||||
0000000001000608 <fun_three>:
|
||||
1000608: b3 c1 00 2b ldgr %f2,%r11
|
||||
100060c: b3 c1 00 0f ldgr %f0,%r15
|
||||
1000610: e3 f0 ff 50 ff 71 lay %r15,-176(%r15)
|
||||
1000616: b9 04 00 bf lgr %r11,%r15
|
||||
...
|
||||
it becomes clear what is going on. This is an unusual prologue.
|
||||
|
||||
Rather than saving r11 (frame pointer) and r15 (stack pointer) to stack,
|
||||
instead they're saved into call-clobbered floating point registers.
|
||||
|
||||
[ For reference, this is the prologue of fun_two:
|
||||
...
|
||||
0000000001000640 <fun_two>:
|
||||
1000640: eb bf f0 58 00 24 stmg %r11,%r15,88(%r15)
|
||||
1000646: e3 f0 ff 50 ff 71 lay %r15,-176(%r15)
|
||||
100064c: b9 04 00 bf lgr %r11,%r15
|
||||
...
|
||||
where the first instruction stores registers r11 to r15 to stack. ]
|
||||
|
||||
Gdb fails to properly analyze the prologue, which causes the problems getting
|
||||
the frame info.
|
||||
|
||||
Fix this by:
|
||||
- adding handling of the ldgr insn [1] in s390_analyze_prologue, and
|
||||
- recognizing the insn as saving a register in
|
||||
s390_prologue_frame_unwind_cache.
|
||||
|
||||
This gets us instead:
|
||||
...
|
||||
Stack level 0, frame at 0x0:
|
||||
pc = 0x100061a in fun_three; saved pc = 0x100067a
|
||||
called by frame at 0x3fffffff1f0
|
||||
Arglist at 0xffffffffffffffff, args:
|
||||
Locals at 0xffffffffffffffff, Previous frame's sp in f0
|
||||
...
|
||||
and:
|
||||
...
|
||||
(gdb) backtrace^M
|
||||
#0 0x000000000100061a in fun_three ()^M
|
||||
#1 0x000000000100067a in fun_two ()^M
|
||||
#2 0x00000000010006b6 in fun_one ()^M
|
||||
#3 0x00000000010006ee in main ()^M
|
||||
(gdb) PASS: gdb.base/readnever.exp: backtrace
|
||||
...
|
||||
|
||||
Tested on s390x-linux.
|
||||
|
||||
PR tdep/32417
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32417
|
||||
|
||||
Approved-By: Andreas Arnez <arnez@linux.ibm.com>
|
||||
|
||||
[1] https://www.ibm.com/support/pages/sites/default/files/2021-05/SA22-7871-10.pdf
|
||||
---
|
||||
gdb/s390-tdep.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
gdb/s390-tdep.h | 1 +
|
||||
2 files changed, 40 insertions(+)
|
||||
|
||||
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
|
||||
index 4e7dce70c12..2609b42f797 100644
|
||||
--- a/gdb/s390-tdep.c
|
||||
+++ b/gdb/s390-tdep.c
|
||||
@@ -855,6 +855,11 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
|
||||
|| is_rre (insn64, op_lgr, &r1, &r2))
|
||||
data->gpr[r1] = data->gpr[r2];
|
||||
|
||||
+ /* LDGR r1, r2 --- load from register to floating-point register
|
||||
+ (64-bit version). */
|
||||
+ else if (is_rre (insn64, op_ldgr, &r1, &r2))
|
||||
+ data->fpr[r1] = data->gpr[r2];
|
||||
+
|
||||
/* L r1, d2(x2, b2) --- load. */
|
||||
/* LY r1, d2(x2, b2) --- load (long-displacement version). */
|
||||
/* LG r1, d2(x2, b2) --- load (64-bit version). */
|
||||
@@ -2542,6 +2547,40 @@ s390_prologue_frame_unwind_cache (const frame_info_ptr &this_frame,
|
||||
&& data.fpr_slot[i] != 0)
|
||||
info->saved_regs[S390_F0_REGNUM + i].set_addr (cfa - data.fpr_slot[i]);
|
||||
|
||||
+ /* Handle this type of prologue:
|
||||
+ ldgr %f2,%r11
|
||||
+ ldgr %f0,%r15
|
||||
+ where call-clobbered floating point registers are used as register save
|
||||
+ slots. */
|
||||
+ for (i = 0; i < S390_NUM_FPRS; i++)
|
||||
+ {
|
||||
+ int fpr = S390_F0_REGNUM + i;
|
||||
+
|
||||
+ /* Check that fpr is a call-clobbered register. */
|
||||
+ if (s390_register_call_saved (gdbarch, fpr))
|
||||
+ continue;
|
||||
+
|
||||
+ /* Check that fpr contains the value of a register at function
|
||||
+ entry. */
|
||||
+ if (data.fpr[i].kind != pvk_register)
|
||||
+ continue;
|
||||
+
|
||||
+ int entry_val_reg = data.fpr[i].reg;
|
||||
+
|
||||
+ /* Check that entry_val_reg is a call-saved register. */
|
||||
+ if (!s390_register_call_saved (gdbarch, entry_val_reg))
|
||||
+ continue;
|
||||
+
|
||||
+ /* In the prologue, we've copied:
|
||||
+ - the value of a call-saved register (entry_val_reg) at function
|
||||
+ entry, to
|
||||
+ - a call-clobbered floating point register (fpr).
|
||||
+
|
||||
+ Heuristic: assume that makes the floating point register a register
|
||||
+ save slot, leaving the value constant throughout the function. */
|
||||
+ info->saved_regs[entry_val_reg].set_realreg (fpr);
|
||||
+ }
|
||||
+
|
||||
/* Function return will set PC to %r14. */
|
||||
info->saved_regs[S390_PSWA_REGNUM] = info->saved_regs[S390_RETADDR_REGNUM];
|
||||
|
||||
diff --git a/gdb/s390-tdep.h b/gdb/s390-tdep.h
|
||||
index 10f775f468f..b098d735a13 100644
|
||||
--- a/gdb/s390-tdep.h
|
||||
+++ b/gdb/s390-tdep.h
|
||||
@@ -82,6 +82,7 @@ enum
|
||||
op1_lgfi = 0xc0, op2_lgfi = 0x01,
|
||||
op_lr = 0x18,
|
||||
op_lgr = 0xb904,
|
||||
+ op_ldgr = 0xb3c1,
|
||||
op_l = 0x58,
|
||||
op1_ly = 0xe3, op2_ly = 0x58,
|
||||
op1_lg = 0xe3, op2_lg = 0x04,
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,143 +0,0 @@
|
||||
From 69e165afa3d45cfac89ed6be298ac6465c84c0fd Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Wed, 15 Jan 2025 17:02:00 +0100
|
||||
Subject: [PATCH 25/46] Fix gdb.base/store.exp on s390x
|
||||
|
||||
On s390x-linux, I get:
|
||||
...
|
||||
(gdb) print l^M
|
||||
$29 = 0^M
|
||||
(gdb) FAIL: gdb.base/store.exp: var doublest l; print old l, expecting -1
|
||||
...
|
||||
|
||||
So, we're in wack_doublest trying to print l, which is a copy of parameter u:
|
||||
...
|
||||
register doublest l = u, r = v;
|
||||
...
|
||||
which does have the expected value:
|
||||
...
|
||||
(gdb) p u
|
||||
$1 = -1
|
||||
...
|
||||
which is a long double, 16 bytes and looks like this:
|
||||
...
|
||||
(gdb) p /x u
|
||||
$3 = 0xbfff0000000000000000000000000000
|
||||
...
|
||||
|
||||
Parameter u is passed in two registers:
|
||||
...
|
||||
<2><6a5>: Abbrev Number: 15 (DW_TAG_formal_parameter)
|
||||
<6a6> DW_AT_name : v
|
||||
<69e> DW_AT_location : 6 byte block: 50 93 8 51 93 8 \
|
||||
(DW_OP_reg0 (r0); DW_OP_piece: 8; DW_OP_reg1 (r1); DW_OP_piece: 8)
|
||||
...
|
||||
and indeed we find the msw in r0 and the lsw in r1:
|
||||
...
|
||||
(gdb) p /x $r0
|
||||
$4 = 0xbfff000000000000
|
||||
(gdb) p /x $r1
|
||||
$5 = 0x0
|
||||
(gdb)
|
||||
...
|
||||
|
||||
Likewise, variable l consists of two registers:
|
||||
...
|
||||
<2><6b5>: Abbrev Number: 13 (DW_TAG_variable)
|
||||
<6b6> DW_AT_name : l
|
||||
<6be> DW_AT_location : 6 byte block: 68 93 8 69 93 8 \
|
||||
(DW_OP_reg24 (f8); DW_OP_piece: 8; DW_OP_reg25 (f10); DW_OP_piece: 8)
|
||||
...
|
||||
and we find the same values there:
|
||||
...
|
||||
(gdb) p /x $f8
|
||||
$6 = 0xbfff000000000000
|
||||
(gdb) p /x $f10
|
||||
$7 = 0x0
|
||||
...
|
||||
|
||||
So, we get the expected results when fetching the value from two gprs, but not
|
||||
when fetching the value from two fprs.
|
||||
|
||||
When fetching the values from the two fprs, we stumble upon a particularity of
|
||||
the DWARF register numbers as defined by the s390x ABI [1]: dwarf register 24
|
||||
maps to both floating-point register f8 (8 bytes), and vector register v8
|
||||
(16 bytes).
|
||||
|
||||
In s390_dwarf_reg_to_regnum, it's determined which of the two is chosen, and
|
||||
if available vector registers are preferred over floating-point registers, so
|
||||
v8 is chosen, and used to fetch the value.
|
||||
|
||||
Since the size of the DW_OP_piece is 8 bytes, and the register size is 16
|
||||
bytes, this bit in rw_pieced_value is activated:
|
||||
...
|
||||
/* If the piece is located in a register, but does not
|
||||
occupy the entire register, the placement of the piece
|
||||
within that register is defined by the ABI. */
|
||||
bits_to_skip
|
||||
+= 8 * gdbarch_dwarf2_reg_piece_offset (arch, gdb_regnum,
|
||||
p->size / 8);
|
||||
...
|
||||
but since the default implemention default_dwarf2_reg_piece_offset does not
|
||||
match the s390x ABI, we get the wrong answer.
|
||||
|
||||
This is a known problem, see FOSDEM 2018 presentation "DWARF Pieces And Other
|
||||
DWARF Location Woes" [2].
|
||||
|
||||
Fix this by adding s390_dwarf2_reg_piece_offset, roughly implementing the same
|
||||
logic as in s390_value_from_register.
|
||||
|
||||
Tested on s390x-linux.
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
|
||||
[1] https://github.com/IBM/s390x-abi
|
||||
[2] https://archive.fosdem.org/2018/schedule/event/dwarfpieces
|
||||
---
|
||||
gdb/s390-tdep.c | 23 +++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
|
||||
index 2609b42f797..a7c58b37276 100644
|
||||
--- a/gdb/s390-tdep.c
|
||||
+++ b/gdb/s390-tdep.c
|
||||
@@ -1260,6 +1260,28 @@ s390_value_from_register (gdbarch *gdbarch, type *type, int regnum,
|
||||
return value;
|
||||
}
|
||||
|
||||
+/* Implementation of the gdbarch_dwarf2_reg_piece_offset hook. */
|
||||
+
|
||||
+static ULONGEST
|
||||
+s390_dwarf2_reg_piece_offset (gdbarch *gdbarch, int gdb_regnum, ULONGEST size)
|
||||
+{
|
||||
+ s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
|
||||
+
|
||||
+ /* Floating point register. */
|
||||
+ if (gdb_regnum >= S390_F0_REGNUM && gdb_regnum <= S390_F15_REGNUM)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Vector register, v0 - v15. */
|
||||
+ if (regnum_is_vxr_full (tdep, gdb_regnum))
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Vector register, v16 - v31. */
|
||||
+ if (gdb_regnum >= S390_V16_REGNUM && gdb_regnum <= S390_V31_REGNUM)
|
||||
+ return 0;
|
||||
+
|
||||
+ return default_dwarf2_reg_piece_offset (gdbarch, gdb_regnum, size);
|
||||
+}
|
||||
+
|
||||
/* Implement pseudo_register_name tdesc method. */
|
||||
|
||||
static const char *
|
||||
@@ -7259,6 +7281,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
set_gdbarch_stab_reg_to_regnum (gdbarch, s390_dwarf_reg_to_regnum);
|
||||
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_dwarf_reg_to_regnum);
|
||||
set_gdbarch_value_from_register (gdbarch, s390_value_from_register);
|
||||
+ set_gdbarch_dwarf2_reg_piece_offset (gdbarch, s390_dwarf2_reg_piece_offset);
|
||||
|
||||
/* Pseudo registers. */
|
||||
set_gdbarch_pseudo_register_read (gdbarch, s390_pseudo_register_read);
|
||||
--
|
||||
2.43.0
|
||||
|
148
fix-pr30369-regression-on-aarch64-arm-pr30506.patch
Normal file
148
fix-pr30369-regression-on-aarch64-arm-pr30506.patch
Normal file
@@ -0,0 +1,148 @@
|
||||
From 11a41bc318ba0307248eadf29bf7d4a1af31d3a8 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 16 May 2023 17:00:51 +0100
|
||||
Subject: [PATCH 2/2] Fix PR30369 regression on aarch64/arm (PR30506)
|
||||
|
||||
The gdb.dwarf2/dw2-prologue-end-2.exp test was failing for both AArch64 and
|
||||
Arm.
|
||||
|
||||
As Tom pointed out here (https://inbox.sourceware.org/gdb-patches/6663707c-4297-c2f2-a0bd-f3e84fc62aad@suse.de/),
|
||||
there are issues with both the prologue skipper for AArch64 and Arm and an
|
||||
incorrect assumption by the testcase.
|
||||
|
||||
This patch fixes both of AArch64's and Arm's prologue skippers to not skip past
|
||||
the end of a function. It also incorporates a fix to the testcase so it
|
||||
doesn't assume the prologue skipper will stop at the first instruction of the
|
||||
functions/labels.
|
||||
|
||||
Regression-tested on aarch64-linux/arm-linux Ubuntu 20.04/22.04 and
|
||||
x86_64-linux Ubuntu 20.04.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30506
|
||||
|
||||
Co-Authored-By: Tom de Vries <tdevries@suse.de>
|
||||
Co-Authored-By: Luis Machado <luis.machado@arm.com>
|
||||
---
|
||||
gdb/aarch64-tdep.c | 10 +++++++--
|
||||
gdb/arm-tdep.c | 21 ++++++++++++++++---
|
||||
.../gdb.dwarf2/dw2-prologue-end-2.exp | 12 +++++------
|
||||
3 files changed, 32 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
|
||||
index 499b87ef480..e21d18f5c8c 100644
|
||||
--- a/gdb/aarch64-tdep.c
|
||||
+++ b/gdb/aarch64-tdep.c
|
||||
@@ -896,12 +896,15 @@ aarch64_analyze_prologue_test (void)
|
||||
static CORE_ADDR
|
||||
aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
{
|
||||
- CORE_ADDR func_addr, limit_pc;
|
||||
+ CORE_ADDR func_addr, func_end_addr, limit_pc;
|
||||
|
||||
/* See if we can determine the end of the prologue via the symbol
|
||||
table. If so, then return either PC, or the PC after the
|
||||
prologue, whichever is greater. */
|
||||
- if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
|
||||
+ bool func_addr_found
|
||||
+ = find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr);
|
||||
+
|
||||
+ if (func_addr_found)
|
||||
{
|
||||
CORE_ADDR post_prologue_pc
|
||||
= skip_prologue_using_sal (gdbarch, func_addr);
|
||||
@@ -921,6 +924,9 @@ aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
if (limit_pc == 0)
|
||||
limit_pc = pc + 128; /* Magic. */
|
||||
|
||||
+ limit_pc
|
||||
+ = func_end_addr == 0? limit_pc : std::min (limit_pc, func_end_addr - 4);
|
||||
+
|
||||
/* Try disassembling prologue. */
|
||||
return aarch64_analyze_prologue (gdbarch, pc, limit_pc, NULL);
|
||||
}
|
||||
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
|
||||
index 58b9c5f4bd8..ecffb9223e1 100644
|
||||
--- a/gdb/arm-tdep.c
|
||||
+++ b/gdb/arm-tdep.c
|
||||
@@ -1768,12 +1768,18 @@ arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch)
|
||||
static CORE_ADDR
|
||||
arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
{
|
||||
- CORE_ADDR func_addr, limit_pc;
|
||||
+ CORE_ADDR func_addr, func_end_addr, limit_pc;
|
||||
|
||||
/* See if we can determine the end of the prologue via the symbol table.
|
||||
If so, then return either PC, or the PC after the prologue, whichever
|
||||
is greater. */
|
||||
- if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
|
||||
+ bool func_addr_found
|
||||
+ = find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr);
|
||||
+
|
||||
+ /* Whether the function is thumb mode or not. */
|
||||
+ bool func_is_thumb = false;
|
||||
+
|
||||
+ if (func_addr_found)
|
||||
{
|
||||
CORE_ADDR post_prologue_pc
|
||||
= skip_prologue_using_sal (gdbarch, func_addr);
|
||||
@@ -1810,7 +1816,8 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
associate prologue code with the opening brace; so this
|
||||
lets us skip the first line if we think it is the opening
|
||||
brace. */
|
||||
- if (arm_pc_is_thumb (gdbarch, func_addr))
|
||||
+ func_is_thumb = arm_pc_is_thumb (gdbarch, func_addr);
|
||||
+ if (func_is_thumb)
|
||||
analyzed_limit = thumb_analyze_prologue (gdbarch, func_addr,
|
||||
post_prologue_pc, NULL);
|
||||
else
|
||||
@@ -1836,6 +1843,14 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
||||
if (limit_pc == 0)
|
||||
limit_pc = pc + 64; /* Magic. */
|
||||
|
||||
+ /* Set the correct adjustment based on whether the function is thumb mode or
|
||||
+ not. We use it to get the address of the last instruction in the
|
||||
+ function (as opposed to the first address of the next function). */
|
||||
+ CORE_ADDR adjustment = func_is_thumb? 2 : 4;
|
||||
+
|
||||
+ limit_pc
|
||||
+ = func_end_addr == 0? limit_pc : std::min (limit_pc,
|
||||
+ func_end_addr - adjustment);
|
||||
|
||||
/* Check if this is Thumb code. */
|
||||
if (arm_pc_is_thumb (gdbarch, pc))
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp
|
||||
index 642b73fe2a1..da49902c13c 100644
|
||||
--- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp
|
||||
@@ -95,17 +95,17 @@ if { $break_addr == "" } {
|
||||
return
|
||||
}
|
||||
|
||||
-# Get the "foo_label" address.
|
||||
+# Get the "bar_label" address.
|
||||
|
||||
-set foo_label_addr ""
|
||||
-gdb_test_multiple "print /x &foo_label" "" {
|
||||
+set bar_label_addr ""
|
||||
+gdb_test_multiple "print /x &bar_label" "" {
|
||||
-re -wrap "= ($hex)" {
|
||||
- set foo_label_addr $expect_out(1,string)
|
||||
+ set bar_label_addr $expect_out(1,string)
|
||||
pass $gdb_test_name
|
||||
}
|
||||
}
|
||||
|
||||
-if { $foo_label_addr == "" } {
|
||||
+if { $bar_label_addr == "" } {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -117,4 +117,4 @@ gdb_test "print &foo_end == &bar_label" " = 1"
|
||||
# Check that the breakpoint is set at the expected address. Regression test
|
||||
# for PR30369.
|
||||
|
||||
-gdb_assert { $break_addr == $foo_label_addr }
|
||||
+gdb_assert { $break_addr < $bar_label_addr }
|
||||
--
|
||||
2.35.3
|
||||
|
29
fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch
Normal file
29
fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch
Normal file
@@ -0,0 +1,29 @@
|
||||
fixup-2-gdb-rhbz1553104-s390x-arch12-test
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.arch/s390x-arch12.exp | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
index 246c1e1c69a..7939a2d6932 100644
|
||||
--- a/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
@@ -31,4 +31,18 @@ gdb_exit
|
||||
gdb_start
|
||||
gdb_load $ofile
|
||||
|
||||
+set supported 0
|
||||
+gdb_test_multiple "show arch" "" {
|
||||
+ -re -wrap "\"s390:64-bit\".*" {
|
||||
+ set supported 1
|
||||
+ }
|
||||
+ -re -wrap "" {
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { ! $supported } {
|
||||
+ unsupported "No s390x support"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
gdb_test "disas load_guarded" " <\\+28>:\tlgg\t%r1,0\\(%r1\\)\r\n\[^\r\n\]* <\\+34>:\tstg\t%r1,168\\(%r11\\)\r\n.*"
|
30
fixup-gdb-6.3-attach-see-vdso-test.patch
Normal file
30
fixup-gdb-6.3-attach-see-vdso-test.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 19dc95258888a9e110ad54fa25a613611956a13f Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 13 Jun 2023 15:04:32 +0200
|
||||
Subject: [PATCH 5/6] fixup gdb-6.3-attach-see-vdso-test.patch
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/attach-see-vdso.exp | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.exp b/gdb/testsuite/gdb.base/attach-see-vdso.exp
|
||||
index 5457ec4129d..35c49731f0b 100644
|
||||
--- a/gdb/testsuite/gdb.base/attach-see-vdso.exp
|
||||
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.exp
|
||||
@@ -34,10 +34,11 @@ set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]]
|
||||
# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64).
|
||||
#
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } {
|
||||
- gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail."
|
||||
+ unsupported "Testcase nonthreaded compile failed, so all tests in this file will automatically fail."
|
||||
+ return
|
||||
}
|
||||
|
||||
-if [get_compiler_info ${binfile}] {
|
||||
+if [get_compiler_info] {
|
||||
return -1
|
||||
}
|
||||
|
||||
--
|
||||
2.35.3
|
||||
|
25
fixup-gdb-6.3-gstack-20050411.patch
Normal file
25
fixup-gdb-6.3-gstack-20050411.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
From 8c0ae8c3c6fa34f046131f76871db13bc392a440 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 13 Jun 2023 14:56:55 +0200
|
||||
Subject: [PATCH 4/6] fixup gdb-6.3-gstack-20050411.patch
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/gstack.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
|
||||
index 089407ec04a..a5dacd582ff 100644
|
||||
--- a/gdb/testsuite/gdb.base/gstack.exp
|
||||
+++ b/gdb/testsuite/gdb.base/gstack.exp
|
||||
@@ -52,7 +52,7 @@ gdb_expect {
|
||||
# exiting the function. Still we could retry the gstack command if we fail.
|
||||
|
||||
set test "spawn gstack"
|
||||
-set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $BUILD_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
|
||||
+set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $GDB_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
|
||||
set res [remote_spawn host $command];
|
||||
if { $res < 0 || $res == "" } {
|
||||
perror "Spawning $command failed."
|
||||
--
|
||||
2.35.3
|
||||
|
35
fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch
Normal file
35
fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
Fixup gdb.base/tracefork-zombie.exp
|
||||
|
||||
Fix ERROR:
|
||||
...
|
||||
PASS: gdb.base/tracefork-zombie.exp: attach
|
||||
ERROR: tcl error sourcing gdb/testsuite/gdb.base/tracefork-zombie.exp.
|
||||
ERROR: tcl error code POSIX ESRCH {no such process}
|
||||
ERROR: error reading "file12": no such process
|
||||
while executing
|
||||
"read $statusfi"
|
||||
("foreach" body line 5)
|
||||
invoked from within
|
||||
...
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/tracefork-zombie.exp | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp
|
||||
index 03f790d4c5d..3e2e5517d46 100644
|
||||
--- a/gdb/testsuite/gdb.base/tracefork-zombie.exp
|
||||
+++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp
|
||||
@@ -58,8 +58,10 @@ foreach procpid [glob -directory /proc -type d {[0-9]*}] {
|
||||
if {[catch {open $procpid/status} statusfi]} {
|
||||
continue
|
||||
}
|
||||
- set status [read $statusfi]
|
||||
- close $statusfi
|
||||
+ if {[catch {read $statusfi} status]} {
|
||||
+ continue
|
||||
+ }
|
||||
+ catch {close $statusfi}
|
||||
if {1
|
||||
&& [regexp -line {^Name:\tgdb$} $status]
|
||||
&& [regexp -line {^PPid:\t1$} $status]
|
22
fixup-gdb-bz634108-solib_address.patch
Normal file
22
fixup-gdb-bz634108-solib_address.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
From 023314feb400836eb377a5bc9151850fcdd81b11 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 6 Jun 2023 09:43:36 +0200
|
||||
Subject: [PATCH 3/4] Fixup gdb-bz634108-solib_address.patch
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.python/rh634108-solib_address.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
index 99e6aaba831..ebf00babc34 100644
|
||||
--- a/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
@@ -21,4 +21,4 @@ gdb_start
|
||||
# Skip all tests if Python scripting is not enabled.
|
||||
if { [skip_python_tests] } { continue }
|
||||
|
||||
-gdb_test "python print (gdb.solib_name(-1))" "None" "gdb.solib_name exists"
|
||||
+gdb_test "python print (gdb.solib_name(0))" "None" "gdb.solib_name exists"
|
||||
--
|
||||
2.35.3
|
||||
|
19
fixup-gdb-glibc-strstr-workaround.patch
Normal file
19
fixup-gdb-glibc-strstr-workaround.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
fixup-gdb-glibc-strstr-workaround.patch
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
index 889f8c6f584..052bd84d420 100644
|
||||
--- a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
@@ -68,7 +68,7 @@ gdb_test_multiple $test $test {
|
||||
set addr $expect_out(1,string)
|
||||
pass "$test (fixed glibc)"
|
||||
}
|
||||
- -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
||||
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <(__GI_)?strstr>\r\n$gdb_prompt $" {
|
||||
untested "$test (gnu-ifunc not in use by glibc)"
|
||||
return 0
|
||||
}
|
26
fixup-gdb-lineno-makeup-test.patch
Normal file
26
fixup-gdb-lineno-makeup-test.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From 266359a17e77a53d4ebaa4f3b15c2ae39e43fca0 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 13 Jun 2023 15:07:22 +0200
|
||||
Subject: [PATCH 6/6] fixup gdb-lineno-makeup-test.patch
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/lineno-makeup.exp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp
|
||||
index 9e11d78bf9c..d31e063bdc2 100644
|
||||
--- a/gdb/testsuite/gdb.base/lineno-makeup.exp
|
||||
+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp
|
||||
@@ -21,7 +21,8 @@ set binfuncfile [standard_output_file ${testfile}-func.bin]
|
||||
set binfile [standard_output_file ${testfile}]
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
|
||||
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+ unsupported "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+ return
|
||||
}
|
||||
|
||||
set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
|
||||
--
|
||||
2.35.3
|
||||
|
24
fixup-gdb-linux_perf-bundle.patch
Normal file
24
fixup-gdb-linux_perf-bundle.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
diff --git a/gdb/gdb.c b/gdb/gdb.c
|
||||
index 82e9e6da210..b5e28445630 100644
|
||||
--- a/gdb/gdb.c
|
||||
+++ b/gdb/gdb.c
|
||||
@@ -20,19 +20,11 @@
|
||||
#include "main.h"
|
||||
#include "interps.h"
|
||||
|
||||
-#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
-extern "C" void __libipt_init(void);
|
||||
-#endif
|
||||
-
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct captured_main_args args;
|
||||
|
||||
-#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
- __libipt_init();
|
||||
-#endif
|
||||
-
|
||||
memset (&args, 0, sizeof args);
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
43
fixup-gdb-rhbz1261564-aarch64-hw-watchpoint-test.pat.patch
Normal file
43
fixup-gdb-rhbz1261564-aarch64-hw-watchpoint-test.pat.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
From e452307ba07f5d798edad73631182e137265da7d Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 13 Jun 2023 17:58:42 +0200
|
||||
Subject: [PATCH 9/9] fixup gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
|
||||
|
||||
---
|
||||
.../rhbz1261564-aarch64-watchpoint.exp | 18 ++++++++++++++----
|
||||
1 file changed, 14 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
|
||||
index b1cf7115663..42ebc25cc49 100644
|
||||
--- a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
|
||||
+++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
|
||||
@@ -20,12 +20,22 @@ if { [prepare_for_testing rhbz1261564-aarch64-watchpoint.exp "rhbz1261564-aarch6
|
||||
if { ! [ runto main ] } then { return 0 }
|
||||
|
||||
set test "rwatch aligned.var4"
|
||||
-if [istarget "s390*-*-*"] {
|
||||
- gdb_test $test {Target does not support this type of hardware watchpoint\.}
|
||||
- untested "s390* does not support hw read watchpoint"
|
||||
+
|
||||
+set supported 1
|
||||
+gdb_test_multiple $test "" {
|
||||
+ -re -wrap "Hardware read watchpoint \[0-9\]+: aligned.var4" {
|
||||
+ pass $gdb_test_name
|
||||
+ }
|
||||
+ -re -wrap "Target does not support this type of hardware watchpoint\\." {
|
||||
+ set supported 0
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { !$supported } {
|
||||
+ unsupported $test
|
||||
return
|
||||
}
|
||||
-gdb_test $test "Hardware read watchpoint \[0-9\]+: aligned.var4"
|
||||
+
|
||||
|
||||
proc checkvar { address } {
|
||||
global gdb_prompt
|
||||
--
|
||||
2.35.3
|
||||
|
19
fixup-gdb-rhbz1553104-s390x-arch12-test.patch
Normal file
19
fixup-gdb-rhbz1553104-s390x-arch12-test.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
fixup-gdb-rhbz1553104-s390x-arch12-test.patch
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.arch/s390x-arch12.exp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
index 4e902ff960d..246c1e1c69a 100644
|
||||
--- a/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
set testfile "s390x-arch12"
|
||||
set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
|
||||
-set ofile "${srcdir}/${subdir}/${testfile}.o"
|
||||
+set ofile [standard_output_file ${testfile}.o]
|
||||
|
||||
if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
|
||||
untested "failed uudecode"
|
38
fixup-gdb-test-bt-cfi-without-die.patch
Normal file
38
fixup-gdb-test-bt-cfi-without-die.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
fixup-gdb-test-bt-cfi-without-die.patch
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/cfi-without-die.exp | 13 ++++++++-----
|
||||
1 file changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
index 5880d46f6d2..db1726646f8 100644
|
||||
--- a/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
+++ b/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
@@ -37,19 +37,22 @@ if ![runto callback] then {
|
||||
fail "verify unwinding: Can't run to callback"
|
||||
return 0
|
||||
}
|
||||
-set test "verify unwinding breaks without CFI"
|
||||
-gdb_test_multiple "bt" $test {
|
||||
+
|
||||
+set as_expected 1
|
||||
+gdb_test_multiple "bt" "" {
|
||||
-re " in \[?\]\[?\] .*\r\n$gdb_prompt $" {
|
||||
# It may backtrace through some random frames even to main().
|
||||
- pass $test
|
||||
}
|
||||
-re " in main .*\r\n$gdb_prompt $" {
|
||||
- fail $test
|
||||
+ set as_expected 0
|
||||
}
|
||||
-re "\r\n$gdb_prompt $" {
|
||||
- pass $test
|
||||
}
|
||||
}
|
||||
+if { ! $as_expected } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
|
||||
object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != ""
|
21
fixup-gdb-test-dw2-aranges.patch
Normal file
21
fixup-gdb-test-dw2-aranges.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
From 81a7585502092b3c133534ac6ecb34fd56d05337 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Thu, 16 Feb 2023 12:56:41 +0100
|
||||
Subject: [PATCH 09/11] fixup gdb-test-dw2-aranges.patch
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.dwarf2/dw2-aranges.S | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
|
||||
index d5b9ca5a3c6..b811f6644cb 100644
|
||||
--- a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
|
||||
@@ -138,3 +138,4 @@ main:
|
||||
.byte 0 /* aranges segment_size */
|
||||
|
||||
.Laranges_end:
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
--
|
||||
2.35.3
|
||||
|
BIN
gdb-13.2.tar.bz2
(Stored with Git LFS)
Normal file
BIN
gdb-13.2.tar.bz2
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
gdb-16.3.tar.bz2
(Stored with Git LFS)
BIN
gdb-16.3.tar.bz2
(Stored with Git LFS)
Binary file not shown.
120
gdb-6.3-attach-see-vdso-test.patch
Normal file
120
gdb-6.3-attach-see-vdso-test.patch
Normal file
@@ -0,0 +1,120 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-attach-see-vdso-test.patch
|
||||
|
||||
;; Test kernel VDSO decoding while attaching to an i386 process.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.c b/gdb/testsuite/gdb.base/attach-see-vdso.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.c
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int main ()
|
||||
+{
|
||||
+ pause ();
|
||||
+ return 1;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.exp b/gdb/testsuite/gdb.base/attach-see-vdso.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/attach-see-vdso.exp
|
||||
@@ -0,0 +1,77 @@
|
||||
+# Copyright 2007
|
||||
+
|
||||
+# 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+
|
||||
+# This test only works on Linux
|
||||
+if { ![istarget "*-*-linux-gnu*"] } {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+if {[use_gdb_stub]} {
|
||||
+ untested "skipping test because of use_gdb_stub"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set testfile "attach-see-vdso"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+set escapedbinfile [string_to_regexp [standard_output_file ${testfile}]]
|
||||
+
|
||||
+# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64).
|
||||
+#
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+if [get_compiler_info ${binfile}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Start the program running and then wait for a bit, to be sure
|
||||
+# that it can be attached to.
|
||||
+
|
||||
+set testpid [eval exec $binfile &]
|
||||
+
|
||||
+# Avoid some race:
|
||||
+sleep 2
|
||||
+
|
||||
+# Start with clean gdb
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+# Never call: gdb_load ${binfile}
|
||||
+# as the former problem would not reproduce otherwise.
|
||||
+
|
||||
+set test "attach"
|
||||
+gdb_test_multiple "attach $testpid" "$test" {
|
||||
+ -re "Attaching to process $testpid\r?\n.*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test "bt" "#0 *0x\[0-9a-f\]* in \[^?\].*" "backtrace decodes VDSO"
|
||||
+
|
||||
+# Exit and detach the process.
|
||||
+
|
||||
+gdb_exit
|
||||
+
|
||||
+# Make sure we don't leave a process around to confuse
|
||||
+# the next test run (and prevent the compile by keeping
|
||||
+# the text file busy), in case the "set should_exit" didn't
|
||||
+# work.
|
||||
+
|
||||
+remote_exec build "kill -9 ${testpid}"
|
109
gdb-6.3-bz202689-exec-from-pthread-test.patch
Normal file
109
gdb-6.3-bz202689-exec-from-pthread-test.patch
Normal file
@@ -0,0 +1,109 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-bz202689-exec-from-pthread-test.patch
|
||||
|
||||
;; Testcase for exec() from threaded program (BZ 202689).
|
||||
;;=fedoratest
|
||||
|
||||
2007-01-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
@@ -0,0 +1,46 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
+ Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <pthread.h>
|
||||
+#include <assert.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+
|
||||
+static void *
|
||||
+threader (void *arg)
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ pthread_t t1;
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&t1, NULL, threader, (void *) NULL);
|
||||
+ assert (i == 0);
|
||||
+ i = pthread_join (t1, NULL);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ execl ("/bin/true", "/bin/true", NULL);
|
||||
+ abort ();
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/threaded-exec.exp
|
||||
@@ -0,0 +1,41 @@
|
||||
+# threaded-exec.exp -- Check reset of the tracked threads on exec*(2)
|
||||
+# Copyright (C) 2007 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Please email any bugs, comments, and/or additions to this file to:
|
||||
+# bug-gdb@prep.ai.mit.edu
|
||||
+
|
||||
+set testfile threaded-exec
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+gdb_run_cmd
|
||||
+
|
||||
+gdb_test_multiple {} "Program exited" {
|
||||
+ -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {
|
||||
+ pass "Program exited"
|
||||
+ }
|
||||
+}
|
258
gdb-6.3-gstack-20050411.patch
Normal file
258
gdb-6.3-gstack-20050411.patch
Normal file
@@ -0,0 +1,258 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Cagney <cagney@gnu.org>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-gstack-20050411.patch
|
||||
|
||||
;; Add a wrapper script to GDB that implements pstack using the
|
||||
;; --readnever option.
|
||||
;;=push
|
||||
|
||||
2004-11-23 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* Makefile.in (uninstall-gstack, install-gstack): New rules, add
|
||||
to install and uninstall.
|
||||
* gstack.sh, gstack.1: New files.
|
||||
|
||||
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
||||
--- a/gdb/Makefile.in
|
||||
+++ b/gdb/Makefile.in
|
||||
@@ -2011,7 +2011,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
|
||||
install: all
|
||||
@$(MAKE) $(FLAGS_TO_PASS) install-only
|
||||
|
||||
-install-only: $(CONFIG_INSTALL)
|
||||
+install-only: install-gstack $(CONFIG_INSTALL)
|
||||
transformed_name=`t='$(program_transform_name)'; \
|
||||
echo gdb | sed -e "$$t"` ; \
|
||||
if test "x$$transformed_name" = x; then \
|
||||
@@ -2061,7 +2061,25 @@ install-guile:
|
||||
install-python:
|
||||
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
|
||||
|
||||
-uninstall: force $(CONFIG_UNINSTALL)
|
||||
+GSTACK=gstack
|
||||
+.PHONY: install-gstack
|
||||
+install-gstack:
|
||||
+ transformed_name=`t='$(program_transform_name)'; \
|
||||
+ echo $(GSTACK) | sed -e "$$t"` ; \
|
||||
+ if test "x$$transformed_name" = x; then \
|
||||
+ transformed_name=$(GSTACK) ; \
|
||||
+ else \
|
||||
+ true ; \
|
||||
+ fi ; \
|
||||
+ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
|
||||
+ $(INSTALL_PROGRAM) $(srcdir)/$(GSTACK).sh \
|
||||
+ $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
|
||||
+ : $(SHELL) $(srcdir)/../mkinstalldirs \
|
||||
+ $(DESTDIR)$(man1dir) ; \
|
||||
+ : $(INSTALL_DATA) $(srcdir)/gstack.1 \
|
||||
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
|
||||
+
|
||||
+uninstall: force uninstall-gstack $(CONFIG_UNINSTALL)
|
||||
transformed_name=`t='$(program_transform_name)'; \
|
||||
echo gdb | sed -e $$t` ; \
|
||||
if test "x$$transformed_name" = x; then \
|
||||
@@ -2092,6 +2110,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
||||
rm -f $(DESTDIR)$(bindir)/$$transformed_name
|
||||
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
|
||||
|
||||
+.PHONY: uninstall-gstack
|
||||
+uninstall-gstack:
|
||||
+ transformed_name=`t='$(program_transform_name)'; \
|
||||
+ echo $(GSTACK) | sed -e $$t` ; \
|
||||
+ if test "x$$transformed_name" = x; then \
|
||||
+ transformed_name=$(GSTACK) ; \
|
||||
+ else \
|
||||
+ true ; \
|
||||
+ fi ; \
|
||||
+ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
|
||||
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
|
||||
+
|
||||
# The C++ name parser can be built standalone for testing.
|
||||
test-cp-name-parser.o: cp-name-parser.c
|
||||
$(COMPILE) -DTEST_CPNAMES cp-name-parser.c
|
||||
diff --git a/gdb/gstack.sh b/gdb/gstack.sh
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/gstack.sh
|
||||
@@ -0,0 +1,43 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+if test $# -ne 1; then
|
||||
+ echo "Usage: `basename $0 .sh` <process-id>" 1>&2
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+if test ! -r /proc/$1; then
|
||||
+ echo "Process $1 not found." 1>&2
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+# GDB doesn't allow "thread apply all bt" when the process isn't
|
||||
+# threaded; need to peek at the process to determine if that or the
|
||||
+# simpler "bt" should be used.
|
||||
+
|
||||
+backtrace="bt"
|
||||
+if test -d /proc/$1/task ; then
|
||||
+ # Newer kernel; has a task/ directory.
|
||||
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
|
||||
+ backtrace="thread apply all bt"
|
||||
+ fi
|
||||
+elif test -f /proc/$1/maps ; then
|
||||
+ # Older kernel; go by it loading libpthread.
|
||||
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
|
||||
+ backtrace="thread apply all bt"
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+GDB=${GDB:-gdb}
|
||||
+
|
||||
+# Run GDB, strip out unwanted noise.
|
||||
+# --readnever is no longer used since .gdb_index is now in use.
|
||||
+$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <<EOF 2>&1 |
|
||||
+set width 0
|
||||
+set height 0
|
||||
+set pagination no
|
||||
+$backtrace
|
||||
+EOF
|
||||
+/bin/sed -n \
|
||||
+ -e 's/^\((gdb) \)*//' \
|
||||
+ -e '/^#/p' \
|
||||
+ -e '/^Thread/p'
|
||||
diff --git a/gdb/testsuite/gdb.base/gstack.c b/gdb/testsuite/gdb.base/gstack.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gstack.c
|
||||
@@ -0,0 +1,43 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005, 2007, 2008, 2009 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 <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+void
|
||||
+func (void)
|
||||
+{
|
||||
+ const char msg[] = "looping\n";
|
||||
+
|
||||
+ /* Use the most simple notification not to get caught by attach on exiting
|
||||
+ the function. */
|
||||
+ write (1, msg, strlen (msg));
|
||||
+
|
||||
+ for (;;);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ alarm (60);
|
||||
+ nice (100);
|
||||
+
|
||||
+ func ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gstack.exp
|
||||
@@ -0,0 +1,84 @@
|
||||
+# Copyright (C) 2012 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/>.
|
||||
+
|
||||
+set testfile gstack
|
||||
+set executable ${testfile}
|
||||
+set binfile [standard_output_file $executable]
|
||||
+if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set test "spawn inferior"
|
||||
+set command "${binfile}"
|
||||
+set res [remote_spawn host $command];
|
||||
+if { $res < 0 || $res == "" } {
|
||||
+ perror "Spawning $command failed."
|
||||
+ fail $test
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# The spawn id of the test inferior.
|
||||
+set test_spawn_id $res
|
||||
+
|
||||
+set use_gdb_stub 1
|
||||
+set pid [exp_pid -i $res]
|
||||
+gdb_expect {
|
||||
+ -re "looping\r\n" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ eof {
|
||||
+ fail "$test (eof)"
|
||||
+ return
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "$test (timeout)"
|
||||
+ return
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Testcase uses the most simple notification not to get caught by attach on
|
||||
+# exiting the function. Still we could retry the gstack command if we fail.
|
||||
+
|
||||
+set test "spawn gstack"
|
||||
+set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $BUILD_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
|
||||
+set res [remote_spawn host $command];
|
||||
+if { $res < 0 || $res == "" } {
|
||||
+ perror "Spawning $command failed."
|
||||
+ fail $test
|
||||
+}
|
||||
+
|
||||
+set gdb_spawn_id $res
|
||||
+
|
||||
+gdb_test_multiple "" $test {
|
||||
+ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test_multiple "" "gstack exits" {
|
||||
+ eof {
|
||||
+ set result [wait -i $gdb_spawn_id]
|
||||
+ verbose $result
|
||||
+
|
||||
+ gdb_assert { [lindex $result 2] == 0 } "gstack exits with no error"
|
||||
+ gdb_assert { [lindex $result 3] == 0 } "gstack's exit status is 0"
|
||||
+
|
||||
+ remote_close host
|
||||
+ clear_gdb_spawn_id
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Kill the test inferior.
|
||||
+kill_wait_spawned_process $test_spawn_id
|
247
gdb-6.3-mapping-zero-inode-test.patch
Normal file
247
gdb-6.3-mapping-zero-inode-test.patch
Normal file
@@ -0,0 +1,247 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-mapping-zero-inode-test.patch
|
||||
|
||||
;; Test GCORE for shmid 0 shared memory mappings.
|
||||
;;=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.c b/gdb/testsuite/gdb.base/gcore-shmid0.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-shmid0.c
|
||||
@@ -0,0 +1,128 @@
|
||||
+/* Copyright 2007, 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
+ Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+/*
|
||||
+ * Test GDB's handling of gcore for mapping with a name but zero inode.
|
||||
+ */
|
||||
+
|
||||
+#include <sys/ipc.h>
|
||||
+#include <sys/shm.h>
|
||||
+#include <stdio.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <assert.h>
|
||||
+#include <time.h>
|
||||
+
|
||||
+/* The same test running in a parallel testsuite may steal us the zero SID,
|
||||
+ even if we never get any EEXIST. Just try a while. */
|
||||
+
|
||||
+#define TIMEOUT_SEC 10
|
||||
+
|
||||
+static volatile int v;
|
||||
+
|
||||
+static void
|
||||
+initialized (void)
|
||||
+{
|
||||
+ v++;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+unresolved (void)
|
||||
+{
|
||||
+ v++;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ int sid;
|
||||
+ unsigned int *addr = (void *) -1L;
|
||||
+ int attempt, round = 0;
|
||||
+ time_t ts_start, ts;
|
||||
+
|
||||
+ if (time (&ts_start) == (time_t) -1)
|
||||
+ {
|
||||
+ printf ("time (): %m\n");
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ /* The generated SID will cycle with an increment of 32768, attempt until it
|
||||
+ * wraps to 0. */
|
||||
+
|
||||
+ for (attempt = 0; addr == (void *) -1L; attempt++)
|
||||
+ {
|
||||
+ /* kernel-2.6.25-8.fc9.x86_64 just never returns the value 0 by
|
||||
+ shmget(2). shmget returns SID range 0..1<<31 in steps of 32768,
|
||||
+ 0x1000 should be enough but wrap the range it to be sure. */
|
||||
+
|
||||
+ if (attempt > 0x21000)
|
||||
+ {
|
||||
+ if (time (&ts) == (time_t) -1)
|
||||
+ {
|
||||
+ printf ("time (): %m\n");
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ if (ts >= ts_start && ts < ts_start + TIMEOUT_SEC)
|
||||
+ {
|
||||
+ attempt = 0;
|
||||
+ round++;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ printf ("Problem is not reproducible on this kernel (attempt %d, "
|
||||
+ "round %d)\n", attempt, round);
|
||||
+ unresolved ();
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ sid = shmget ((key_t) rand (), 0x1000, IPC_CREAT | IPC_EXCL | 0777);
|
||||
+ if (sid == -1)
|
||||
+ {
|
||||
+ if (errno == EEXIST)
|
||||
+ continue;
|
||||
+
|
||||
+ printf ("shmget (%d, 0x1000, IPC_CREAT): errno %d\n", 0, errno);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ /* Use SID only if it is 0, retry it otherwise. */
|
||||
+
|
||||
+ if (sid == 0)
|
||||
+ {
|
||||
+ addr = shmat (sid, NULL, SHM_RND);
|
||||
+ if (addr == (void *) -1L)
|
||||
+ {
|
||||
+ printf ("shmat (%d, NULL, SHM_RND): errno %d\n", sid,
|
||||
+ errno);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+ if (shmctl (sid, IPC_RMID, NULL) != 0)
|
||||
+ {
|
||||
+ printf ("shmctl (%d, IPC_RMID, NULL): errno %d\n", sid, errno);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ initialized ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.exp b/gdb/testsuite/gdb.base/gcore-shmid0.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-shmid0.exp
|
||||
@@ -0,0 +1,101 @@
|
||||
+# Copyright 2007, 2009 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Test GDB's handling of gcore for mapping with a name but zero inode.
|
||||
+
|
||||
+if { [prepare_for_testing gcore-shmid0.exp gcore-shmid0] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Does this gdb support gcore?
|
||||
+set test "help gcore"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Undefined command: .gcore.*$gdb_prompt $" {
|
||||
+ # gcore command not supported -- nothing to test here.
|
||||
+ unsupported "gdb does not support gcore on this target"
|
||||
+ return -1;
|
||||
+ }
|
||||
+ -re "Save a core file .*$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { ! [ runto_main ] } then {
|
||||
+ untested gcore-shmid0.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint "initialized"
|
||||
+gdb_breakpoint "unresolved"
|
||||
+
|
||||
+set oldtimeout $timeout
|
||||
+set timeout [expr $oldtimeout + 120]
|
||||
+
|
||||
+set test "Continue to initialized."
|
||||
+gdb_test_multiple "continue" $test {
|
||||
+ -re "Breakpoint .*, initialized .* at .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Breakpoint .*, unresolved .* at .*\r\n$gdb_prompt $" {
|
||||
+ set timeout $oldtimeout
|
||||
+ unsupported $test
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+set timeout $oldtimeout
|
||||
+
|
||||
+set escapedfilename [string_to_regexp [standard_output_file gcore-shmid0.test]]
|
||||
+
|
||||
+set test "save a corefile"
|
||||
+gdb_test_multiple "gcore [standard_output_file gcore-shmid0.test]" $test {
|
||||
+ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
+ unsupported $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Be sure to remove the handle first.
|
||||
+# But it would get removed even on a kill by GDB as the handle is already
|
||||
+# deleted, just it is still attached.
|
||||
+gdb_continue_to_end "finish"
|
||||
+
|
||||
+set test "core-file command"
|
||||
+gdb_test_multiple "core-file [standard_output_file gcore-shmid0.test]" $test {
|
||||
+ -re ".* program is being debugged already.*y or n. $" {
|
||||
+ # gdb_load may connect us to a gdbserver.
|
||||
+ send_gdb "y\n"
|
||||
+ exp_continue;
|
||||
+ }
|
||||
+ -re "Core was generated by .*\r\n\#0 .*\\\(\\\).*\r\n$gdb_prompt $" {
|
||||
+ # The filename does not fit there anyway so do not check it.
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re ".*registers from core file: File in wrong format.* $" {
|
||||
+ fail "core-file command (could not read registers from core file)"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test "backtrace"
|
||||
+gdb_test_multiple "bt" $test {
|
||||
+ -re "#0 *initialized \\\(\\\) at .*#1 .* main \\\(.*$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "#0 *initialized \\\(\\\) at .*Cannot access memory at address .*$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
134
gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Normal file
134
gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Normal file
@@ -0,0 +1,134 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
|
||||
|
||||
;; Find symbols properly at their original (included) file (BZ 109921).
|
||||
;;=fedoratest
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921
|
||||
|
||||
It is duplicite to its upstream variant:
|
||||
http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html
|
||||
http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html
|
||||
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb.base/included.c, gdb.base/included.exp,
|
||||
gdb.base/included.h: New files.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c,
|
||||
gdb.dwarf2/dw2-included.h: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.c b/gdb/testsuite/gdb.dwarf2/dw2-included.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-included.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2006 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
+ USA. */
|
||||
+
|
||||
+#include "dw2-included.h"
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.exp b/gdb/testsuite/gdb.dwarf2/dw2-included.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-included.exp
|
||||
@@ -0,0 +1,47 @@
|
||||
+# Copyright 2006 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Minimal DWARF-2 unit test
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2.
|
||||
+# For now pick a sampling of likely targets.
|
||||
+if {![istarget *-*-linux*]
|
||||
+ && ![istarget *-*-gnu*]
|
||||
+ && ![istarget *-*-elf*]
|
||||
+ && ![istarget *-*-openbsd*]
|
||||
+ && ![istarget arm-*-eabi*]
|
||||
+ && ![istarget powerpc-*-eabi*]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "dw2-included"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+gdb_test "set listsize 1" ""
|
||||
+gdb_test "list integer" "int integer;\r"
|
||||
+gdb_test "ptype integer" "type = int\r"
|
||||
+# Path varies depending on the build location.
|
||||
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/gdb.dwarf2/dw2-included.h:\r\n${decimal}:.*int integer;\r"
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.h b/gdb/testsuite/gdb.dwarf2/dw2-included.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-included.h
|
||||
@@ -0,0 +1,20 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2006 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
+ USA. */
|
||||
+
|
||||
+int integer;
|
264
gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Normal file
264
gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Normal file
@@ -0,0 +1,264 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
|
||||
|
||||
;; Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
|
||||
;;=push+jan: It should be replaced by Infinity project.
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337
|
||||
|
||||
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to GDB-6.8pre.
|
||||
|
||||
currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you
|
||||
will get:
|
||||
(gdb) p errno
|
||||
[some error]
|
||||
|
||||
* with -ggdb2 and less "errno" in fact does not exist anywhere as it was
|
||||
compiled to "(*__errno_location ())" and the macro definition is not present.
|
||||
Unfortunately gdb will find the TLS symbol and it will try to access it but
|
||||
as the program has been compiled without -lpthread the TLS base register
|
||||
(%gs on i386) is not setup and it will result in:
|
||||
Cannot access memory at address 0x8
|
||||
|
||||
Attached suggestion patch how to deal with the most common "errno" symbol
|
||||
for the most common under-ggdb3 compiled programs.
|
||||
|
||||
Original patch hooked into target_translate_tls_address. But its inferior
|
||||
call invalidates `struct frame *' in the callers - RH BZ 690908.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1166549
|
||||
|
||||
2007-11-03 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* ./gdb/dwarf2read.c (read_partial_die, dwarf2_linkage_name): Prefer
|
||||
DW_AT_MIPS_linkage_name over DW_AT_name now only for non-C.
|
||||
|
||||
glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
|
||||
<81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location
|
||||
<81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location
|
||||
|
||||
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
|
||||
--- a/gdb/printcmd.c
|
||||
+++ b/gdb/printcmd.c
|
||||
@@ -1300,6 +1300,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
|
||||
|
||||
if (exp != nullptr && *exp)
|
||||
{
|
||||
+ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
|
||||
+ function descriptors. */
|
||||
+ if (target_has_execution () && strcmp (exp, "errno") == 0)
|
||||
+ exp = "*(*(int *(*)(void)) __errno_location) ()";
|
||||
/* VOIDPRINT is true to indicate that we do want to print a void
|
||||
value, so invert it for parse_expression. */
|
||||
expression_up expr = parse_expression (exp, nullptr, !voidprint);
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-errno.c
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005, 2007 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/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+#include <errno.h>
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ errno = 42;
|
||||
+
|
||||
+ return 0; /* breakpoint */
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.exp b/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
|
||||
@@ -0,0 +1,60 @@
|
||||
+# Copyright 2007 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/>.
|
||||
+
|
||||
+set testfile dw2-errno
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+proc prep {} {
|
||||
+ global srcdir subdir binfile
|
||||
+ gdb_exit
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}
|
||||
+
|
||||
+ runto_main
|
||||
+
|
||||
+ gdb_breakpoint [gdb_get_line_number "breakpoint"]
|
||||
+ gdb_continue_to_breakpoint "breakpoint"
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+prep
|
||||
+gdb_test "print errno" ".* = 42" "errno with macros=N threads=N"
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+prep
|
||||
+gdb_test "print errno" ".* = 42" "errno with macros=Y threads=N"
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+prep
|
||||
+gdb_test "print errno" ".* = 42" "errno with macros=N threads=Y"
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+prep
|
||||
+gdb_test "print errno" ".* = 42" "errno with macros=Y threads=Y"
|
||||
+
|
||||
+# TODO: Test the error on resolving ERRNO with only libc loaded.
|
||||
+# Just how to find the current libc filename?
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno2.c b/gdb/testsuite/gdb.dwarf2/dw2-errno2.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-errno2.c
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005, 2007 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/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+#include <errno.h>
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ errno = 42;
|
||||
+
|
||||
+ return 0; /* breakpoint */
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp b/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp
|
||||
@@ -0,0 +1,71 @@
|
||||
+# Copyright 2007 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/>.
|
||||
+
|
||||
+set testfile dw2-errno2
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+proc prep { message {do_xfail 0} } { with_test_prefix $message {
|
||||
+ global srcdir subdir binfile variant
|
||||
+ gdb_exit
|
||||
+ gdb_start
|
||||
+ gdb_reinitialize_dir $srcdir/$subdir
|
||||
+ gdb_load ${binfile}${variant}
|
||||
+
|
||||
+ runto_main
|
||||
+
|
||||
+ gdb_breakpoint [gdb_get_line_number "breakpoint"]
|
||||
+ gdb_continue_to_breakpoint "breakpoint"
|
||||
+
|
||||
+ gdb_test "gcore ${binfile}${variant}.core" "\r\nSaved corefile .*" "gcore $variant"
|
||||
+
|
||||
+ gdb_test "print errno" ".* = 42"
|
||||
+
|
||||
+ gdb_test "kill" ".*" "kill" {Kill the program being debugged\? \(y or n\) } "y"
|
||||
+ gdb_test "core-file ${binfile}${variant}.core" "\r\nCore was generated by .*" "core-file"
|
||||
+ if $do_xfail {
|
||||
+ setup_xfail "*-*-*"
|
||||
+ }
|
||||
+ gdb_test "print (int) errno" ".* = 42" "print errno for core"
|
||||
+}}
|
||||
+
|
||||
+set variant g2thrN
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+prep "macros=N threads=N" 1
|
||||
+
|
||||
+set variant g3thrN
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+prep "macros=Y threads=N" 1
|
||||
+
|
||||
+set variant g2thrY
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+prep "macros=N threads=Y"
|
||||
+
|
||||
+set variant g3thrY
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+prep "macros=Y threads=Y" 1
|
||||
+
|
||||
+# TODO: Test the error on resolving ERRNO with only libc loaded.
|
||||
+# Just how to find the current libc filename?
|
107
gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Normal file
107
gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Normal file
@@ -0,0 +1,107 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
|
||||
|
||||
;; Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
|
||||
;;=fedoratest
|
||||
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.c
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2006 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+int main (void)
|
||||
+{
|
||||
+ puts ("hello world");
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb.base/step-over-trampoline.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp
|
||||
@@ -0,0 +1,59 @@
|
||||
+# Copyright 2006 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+if {[use_gdb_stub]} {
|
||||
+ untested "skipping test because of use_gdb_stub"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set testfile step-over-trampoline
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# For C programs, "start" should stop in main().
|
||||
+
|
||||
+gdb_test "start" \
|
||||
+ "main \\(\\) at .*$srcfile.*" \
|
||||
+ "start"
|
||||
+
|
||||
+# main () at hello2.c:5
|
||||
+# 5 puts("hello world\n");
|
||||
+# (gdb) next
|
||||
+# 0x100007e0 in call___do_global_ctors_aux ()
|
||||
+
|
||||
+gdb_test_multiple "next" "invalid `next' output" {
|
||||
+ -re "\nhello world.*return 0;.*" {
|
||||
+ pass "stepped over"
|
||||
+ }
|
||||
+ -re " in call___do_global_ctors_aux \\(\\).*" {
|
||||
+ fail "stepped into trampoline"
|
||||
+ }
|
||||
+}
|
89
gdb-6.5-bz243845-stale-testing-zombie-test.patch
Normal file
89
gdb-6.5-bz243845-stale-testing-zombie-test.patch
Normal file
@@ -0,0 +1,89 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-bz243845-stale-testing-zombie-test.patch
|
||||
|
||||
;; Test leftover zombie process (BZ 243845).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp
|
||||
@@ -0,0 +1,76 @@
|
||||
+# Copyright 2007 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+# are we on a target board
|
||||
+if {[use_gdb_stub]} {
|
||||
+ untested "skipping test because of use_gdb_stub"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Start the program running and then wait for a bit, to be sure
|
||||
+# that it can be attached to.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_load sleep
|
||||
+
|
||||
+set gdb_pid [exp_pid -i [board_info host fileid]]
|
||||
+set test "identified the child GDB"
|
||||
+if {$gdb_pid != "" && $gdb_pid > 0} {
|
||||
+ pass $test
|
||||
+ verbose -log "Child GDB PID $gdb_pid"
|
||||
+} else {
|
||||
+ fail $test
|
||||
+}
|
||||
+
|
||||
+set testpid [eval exec sleep 10 &]
|
||||
+exec sleep 2
|
||||
+
|
||||
+set test "attach"
|
||||
+gdb_test_multiple "attach $testpid" "$test" {
|
||||
+ -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+ -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
|
||||
+ # Response expected on Cygwin
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Some time to let GDB spawn its testing child.
|
||||
+exec sleep 2
|
||||
+
|
||||
+set found none
|
||||
+foreach procpid [glob -directory /proc -type d {[0-9]*}] {
|
||||
+ if {[catch {open $procpid/status} statusfi]} {
|
||||
+ continue
|
||||
+ }
|
||||
+ set status [read $statusfi]
|
||||
+ close $statusfi
|
||||
+ if {1
|
||||
+ && [regexp -line {^Name:\tgdb$} $status]
|
||||
+ && [regexp -line {^PPid:\t1$} $status]
|
||||
+ && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} {
|
||||
+ set found $procpid
|
||||
+ verbose -log "Found linux_test_for_tracefork zombie PID $procpid"
|
||||
+ }
|
||||
+}
|
||||
+set test "linux_test_for_tracefork leaves no zombie"
|
||||
+if {$found eq {none}} {
|
||||
+ pass $test
|
||||
+} else {
|
||||
+ fail $test
|
||||
+}
|
154
gdb-6.5-gcore-buffer-limit-test.patch
Normal file
154
gdb-6.5-gcore-buffer-limit-test.patch
Normal file
@@ -0,0 +1,154 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-gcore-buffer-limit-test.patch
|
||||
|
||||
;; Test gcore memory and time requirements for large inferiors.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.c b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#define MEGS 64
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ void *mem;
|
||||
+
|
||||
+ mem = malloc (MEGS * 1024ULL * 1024ULL);
|
||||
+
|
||||
+ for (;;)
|
||||
+ sleep (1);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.exp b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
|
||||
@@ -0,0 +1,99 @@
|
||||
+# Copyright 2008 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+if {[use_gdb_stub]} {
|
||||
+ untested "skipping test because of use_gdb_stub"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set testfile gcore-excessive-memory
|
||||
+set srcfile ${testfile}.c
|
||||
+set shfile [standard_output_file ${testfile}-gdb.sh]
|
||||
+set corefile [standard_output_file ${testfile}.core]
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set f [open "|getconf PAGESIZE" "r"]
|
||||
+gets $f pagesize
|
||||
+close $f
|
||||
+
|
||||
+set pid_of_bin [eval exec $binfile &]
|
||||
+sleep 2
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
|
||||
+
|
||||
+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
|
||||
+gdb_test "up 99" "in main .*" "verify we can get to main"
|
||||
+
|
||||
+proc memory_v_pages_get {} {
|
||||
+ global pid_of_gdb pagesize
|
||||
+ set fd [open "/proc/$pid_of_gdb/statm"]
|
||||
+ gets $fd line
|
||||
+ close $fd
|
||||
+ # number of pages of virtual memory
|
||||
+ scan $line "%d" drs
|
||||
+ return $drs
|
||||
+}
|
||||
+
|
||||
+set pages_found [memory_v_pages_get]
|
||||
+
|
||||
+# It must be definitely less than `MEGS' of `gcore-excessive-memory.c'.
|
||||
+set mb_gcore_reserve 4
|
||||
+verbose -log "pages_found = $pages_found, mb_gcore_reserve = $mb_gcore_reserve"
|
||||
+set kb_found [expr $pages_found * $pagesize / 1024]
|
||||
+set kb_permit [expr $kb_found + 1 * 1024 + $mb_gcore_reserve * 1024]
|
||||
+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
|
||||
+
|
||||
+# Create the ulimit wrapper.
|
||||
+set f [open $shfile "w"]
|
||||
+puts $f "#! /bin/sh"
|
||||
+puts $f "ulimit -v $kb_permit"
|
||||
+puts $f "exec $GDB \"\$@\""
|
||||
+close $f
|
||||
+remote_exec host "chmod +x $shfile"
|
||||
+
|
||||
+gdb_exit
|
||||
+set GDBold $GDB
|
||||
+set GDB "$shfile"
|
||||
+gdb_start
|
||||
+set GDB $GDBold
|
||||
+
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
|
||||
+
|
||||
+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
|
||||
+gdb_test "up 99" "in main .*" "verify we can get to main"
|
||||
+
|
||||
+verbose -log "kb_found before gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
|
||||
+
|
||||
+gdb_test "gcore $corefile" "Saved corefile \[^\n\r\]*" "Save the core file"
|
||||
+
|
||||
+verbose -log "kb_found after gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
|
||||
+
|
||||
+# Cleanup.
|
||||
+exec kill -9 $pid_of_bin
|
135
gdb-6.5-ia64-libunwind-leak-test.patch
Normal file
135
gdb-6.5-ia64-libunwind-leak-test.patch
Normal file
@@ -0,0 +1,135 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-ia64-libunwind-leak-test.patch
|
||||
|
||||
;; Test ia64 memory leaks of the code using libunwind.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/unwind-leak.c b/gdb/testsuite/gdb.base/unwind-leak.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/unwind-leak.c
|
||||
@@ -0,0 +1,29 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ for (;;)
|
||||
+ alarm (0);
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/unwind-leak.exp b/gdb/testsuite/gdb.base/unwind-leak.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/unwind-leak.exp
|
||||
@@ -0,0 +1,88 @@
|
||||
+# Copyright 2007 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+if {[use_gdb_stub]} {
|
||||
+ untested "skipping test because of use_gdb_stub"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set testfile unwind-leak
|
||||
+set srcfile ${testfile}.c
|
||||
+set shfile [standard_output_file ${testfile}-gdb.sh]
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+set pid [exp_pid -i [board_info host fileid]]
|
||||
+
|
||||
+# For C programs, "start" should stop in main().
|
||||
+
|
||||
+gdb_test "start" \
|
||||
+ "main \\(\\) at .*$srcfile.*" \
|
||||
+ "start"
|
||||
+
|
||||
+set loc [gdb_get_line_number "alarm"]
|
||||
+gdb_breakpoint $loc
|
||||
+
|
||||
+proc memory_get {} {
|
||||
+ global pid
|
||||
+ set fd [open "/proc/$pid/statm"]
|
||||
+ gets $fd line
|
||||
+ close $fd
|
||||
+ # number of pages of data/stack
|
||||
+ scan $line "%*d%*d%*d%*d%*d%d" drs
|
||||
+ return $drs
|
||||
+}
|
||||
+
|
||||
+set cycles 100
|
||||
+# For 100 cycles it was 1308: from = 363 KB, to = 1671 KB
|
||||
+set permit_kb 100
|
||||
+verbose -log "cycles = $cycles, permit_kb = $permit_kb"
|
||||
+
|
||||
+set fail 0
|
||||
+set test "breakpoint stop/continue cycles"
|
||||
+for {set i $cycles} {$i > 0} {set i [expr {$i - 1}]} {
|
||||
+ gdb_test_multiple "continue" $test {
|
||||
+ -re "Breakpoint 2, main .*alarm .*.*${gdb_prompt} $" {
|
||||
+ }
|
||||
+ -re "Segmentation fault" {
|
||||
+ fail $test
|
||||
+ set i 0
|
||||
+ set fail 1
|
||||
+ }
|
||||
+ }
|
||||
+ if ![info exists from] {
|
||||
+ set from [memory_get]
|
||||
+ }
|
||||
+}
|
||||
+set to [memory_get]
|
||||
+if {!$fail} {
|
||||
+ verbose -log "from = $from KB, to = $to KB"
|
||||
+ if {$from > 0 && $to > 10 && $to < $from + $permit_kb} {
|
||||
+ pass $test
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
62
gdb-6.5-last-address-space-byte-test.patch
Normal file
62
gdb-6.5-last-address-space-byte-test.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-last-address-space-byte-test.patch
|
||||
|
||||
;; Testcase for deadlocking on last address space byte; for corrupted backtraces.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/largecore-last-address-lock.exp b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp
|
||||
@@ -0,0 +1,49 @@
|
||||
+# Copyright 2006 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+
|
||||
+# i386 (32-bit) only: gdb with Red Hat largecore patch did lock up:
|
||||
+# https://enterprise.redhat.com/issue-tracker/?module=issues&action=view&tid=103263
|
||||
+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=210614
|
||||
+
|
||||
+# i386: Bug exists when the `target_xfer_memory' condition
|
||||
+# `(memaddr + len < region->hi)' operates on 64-bit operands on
|
||||
+# largecore-patched with 32-bit addresses and so it can get `false' with
|
||||
+# arbitrary `len'.
|
||||
+
|
||||
+# x86_64: The bug is not present as the operands and calculations have the same
|
||||
+# bit size. Would would still need to pass there the highest address
|
||||
+# (`memaddr == 0xffffffffffffffff') but we would need to pass `len == 0'
|
||||
+# to make the condition `(memaddr + len < region->hi)' false.
|
||||
+# `len == 0' would get caught eariler.
|
||||
+
|
||||
+# Error in the success case is immediate.
|
||||
+set timeoutold ${timeout}
|
||||
+set timeout 10
|
||||
+
|
||||
+gdb_test "x/xb 0xffffffff" \
|
||||
+ "Cannot access memory at address 0xffffffff" \
|
||||
+ "Read the last address space byte"
|
||||
+
|
||||
+set timeout ${timeoutold}
|
95
gdb-6.5-missed-trap-on-step-test.patch
Normal file
95
gdb-6.5-missed-trap-on-step-test.patch
Normal file
@@ -0,0 +1,95 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-missed-trap-on-step-test.patch
|
||||
|
||||
;; Test hiding unexpected breakpoints on intentional step commands.
|
||||
;;=fedoratest
|
||||
|
||||
Fix has been committed to:
|
||||
gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.c
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+static int var;
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ var = 1;
|
||||
+ var = 2;
|
||||
+ var = 3;
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.exp b/gdb/testsuite/gdb.base/watchpoint-during-step.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.exp
|
||||
@@ -0,0 +1,44 @@
|
||||
+# Copyright 2007 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+set testfile watchpoint-during-step
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+runto_main
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "var = 2"]
|
||||
+gdb_continue_to_breakpoint "Find the first var set"
|
||||
+
|
||||
+gdb_test "step" ".*var = 3;" "Step to the next var set"
|
||||
+
|
||||
+gdb_test "watch var" "atchpoint .*: var" "Set the watchpoint"
|
||||
+
|
||||
+# Here is the target point. Be careful to not have breakpoint set on the line
|
||||
+# we step from as in this case it is a valid upstream KFAIL gdb/38
|
||||
+
|
||||
+gdb_test "step" ".*Old value = 2.*New value = 3.*" "Catch the watchpoint"
|
127
gdb-6.5-section-num-fixup-test.patch
Normal file
127
gdb-6.5-section-num-fixup-test.patch
Normal file
@@ -0,0 +1,127 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-section-num-fixup-test.patch
|
||||
|
||||
;; Test a crash on libraries missing the .text section.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/datalib-lib.c b/gdb/testsuite/gdb.base/datalib-lib.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/datalib-lib.c
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+int var;
|
||||
diff --git a/gdb/testsuite/gdb.base/datalib-main.c b/gdb/testsuite/gdb.base/datalib-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/datalib-main.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/datalib.exp b/gdb/testsuite/gdb.base/datalib.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/datalib.exp
|
||||
@@ -0,0 +1,56 @@
|
||||
+# Copyright 2008 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+if {[use_gdb_stub]} {
|
||||
+ untested "skipping test because of use_gdb_stub"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set testfile datalib
|
||||
+set srcfilemain ${testfile}-main.c
|
||||
+set srcfilelib ${testfile}-lib.c
|
||||
+set libfile [standard_output_file ${testfile}-lib.so]
|
||||
+set binfile [standard_output_file ${testfile}-main]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilelib}" "${libfile}" executable [list debug {additional_flags=-shared -nostdlib}]] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilemain}" "${binfile} ${libfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# We must use a separate library as the main executable is compiled to the
|
||||
+# address 0 by default and it would get fixed up already at the end of
|
||||
+# INIT_OBJFILE_SECT_INDICES. We also cannot PRELINK it as PRELINK is missing
|
||||
+# on ia64. The library must be NOSTDLIB as otherwise some stub code would
|
||||
+# create the `.text' section there. Also DEBUG option is useful as some of
|
||||
+# the crashes occur in dwarf2read.c.
|
||||
+
|
||||
+# FAIL case:
|
||||
+# ../../gdb/ia64-tdep.c:2838: internal-error: sect_index_text not initialized
|
||||
+# A problem internal to GDB has been detected,
|
||||
+
|
||||
+gdb_test "start" \
|
||||
+ "main \\(\\) at .*${srcfilemain}.*" \
|
||||
+ "start"
|
193
gdb-6.5-sharedlibrary-path.patch
Normal file
193
gdb-6.5-sharedlibrary-path.patch
Normal file
@@ -0,0 +1,193 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-sharedlibrary-path.patch
|
||||
|
||||
;; Fix TLS symbols resolving for shared libraries with a relative pathname.
|
||||
;; The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
|
||||
;;=fedoratest: One should recheck if it is really fixed upstream.
|
||||
|
||||
If you provided some relative path to the shared library, such as with
|
||||
export LD_LIBRARY_PATH=.
|
||||
then gdb would fail to match the shared library name during the TLS lookup.
|
||||
|
||||
Dropped the workaround/fix for gdb-6.8.50.20081128 - is it still needed?
|
||||
|
||||
The testsuite needs `gdb-6.3-bz146810-solib_absolute_prefix_is_empty.patch'.
|
||||
The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
|
||||
|
||||
2006-09-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute
|
||||
requested pathnames to the internal loaded relative pathnames.
|
||||
|
||||
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to GDB-6.7.
|
||||
|
||||
2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to gdb-6.7.50.20080227.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
|
||||
@@ -0,0 +1,31 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2006 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+
|
||||
+extern __thread int var;
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ /* Ensure we link against pthreads even with --as-needed. */
|
||||
+ pthread_testcancel();
|
||||
+ return var;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2006 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+__thread int var = 42;
|
||||
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
|
||||
@@ -0,0 +1,94 @@
|
||||
+# Copyright 2006 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# This test uses gdb_exit and gdb_start, which are not supported
|
||||
+# on non-extended-remote sessions.
|
||||
+if {[use_gdb_stub]} {
|
||||
+ untested "skipping test because of stub"
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set testfile tls-sepdebug
|
||||
+set srcmainfile ${testfile}-main.c
|
||||
+set srcsharedfile ${testfile}-shared.c
|
||||
+
|
||||
+set binmainfile [standard_output_file ${testfile}-main]
|
||||
+set binsharedbase ${testfile}-shared.so
|
||||
+set binsharedfile [standard_output_file ${binsharedbase}]
|
||||
+set binshareddebugfile [standard_output_file ${binsharedbase}.debug]
|
||||
+
|
||||
+# Use explicit -soname as otherwise the full path to the library would get
|
||||
+# encoded into ${binmainfile} making LD_LIBRARY_PATH tests useless.
|
||||
+
|
||||
+# FIXME: gcc dependency (-Wl,-soname).
|
||||
+
|
||||
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } {
|
||||
+ untested "Couldn't compile test library"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# eu-strip(1) works fine but it is a part of `elfutils', not `binutils'.
|
||||
+if 0 then {
|
||||
+ remote_exec build "eu-strip -f ${binshareddebugfile} ${binsharedfile}"
|
||||
+} else {
|
||||
+ remote_exec build "objcopy --only-keep-debug ${binsharedfile} ${binshareddebugfile}"
|
||||
+ remote_exec build "objcopy --strip-debug ${binsharedfile}"
|
||||
+ remote_exec build "objcopy --add-gnu-debuglink=${binshareddebugfile} ${binsharedfile}"
|
||||
+}
|
||||
+
|
||||
+# Do not use `shlib=' as it will automatically add also -rpath for gcc.
|
||||
+
|
||||
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcmainfile} ${binsharedfile}" "${binmainfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+# Test also the proper resolving of relative library names to absolute ones.
|
||||
+# \$PWD is easy - it is the absolute way
|
||||
+# ${subdir} would fail on "print var"
|
||||
+
|
||||
+set absdir [file dirname [standard_output_file ${binsharedbase}]]
|
||||
+foreach ld_library_path [list $absdir [relative_filename [pwd] $absdir]] name { absolute relative } {
|
||||
+
|
||||
+ gdb_exit
|
||||
+ gdb_start
|
||||
+ ###gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+ gdb_test "set env LD_LIBRARY_PATH=$ld_library_path" \
|
||||
+ "" \
|
||||
+ "set env LD_LIBRARY_PATH is $name"
|
||||
+
|
||||
+ gdb_load ${binmainfile}
|
||||
+
|
||||
+ # For C programs, "start" should stop in main().
|
||||
+
|
||||
+ gdb_test "start" \
|
||||
+ "main \\(\\) at .*${srcmainfile}.*" \
|
||||
+ "start"
|
||||
+
|
||||
+ # Check for: Cannot find shared library `/usr/lib/debug/lib/libc-2.4.90.so.debug' in dynamic linker's load module list
|
||||
+ # as happens with TLS variables and `separate_debug_objfile_backlink'.
|
||||
+
|
||||
+ gdb_test "print var" \
|
||||
+ "\\\$1 = \[0-9\].*" \
|
||||
+ "print TLS variable from a shared library with $name-directory separate debug info file"
|
||||
+}
|
19
gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Normal file
19
gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
|
||||
|
||||
;; Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
|
||||
;;=push+jan
|
||||
|
||||
diff --git a/gdb/proc-service.list b/gdb/proc-service.list
|
||||
--- a/gdb/proc-service.list
|
||||
+++ b/gdb/proc-service.list
|
||||
@@ -37,4 +37,7 @@
|
||||
ps_pstop;
|
||||
ps_ptread;
|
||||
ps_ptwrite;
|
||||
+
|
||||
+ /* gdb-6.6-buildid-locate-rpm.patch */
|
||||
+ rpmsqEnable;
|
||||
};
|
136
gdb-6.6-buildid-locate-rpm-suse.patch
Normal file
136
gdb-6.6-buildid-locate-rpm-suse.patch
Normal file
@@ -0,0 +1,136 @@
|
||||
From 444f438fe775a9480b93dc7d63418e0e169b4fbd Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Fri, 21 Apr 2023 09:08:03 +0200
|
||||
Subject: [PATCH 1/5] gdb-6.6-buildid-locate-rpm-suse.patch
|
||||
|
||||
---
|
||||
gdb/build-id.c | 71 +++++++++-----------------------------------------
|
||||
1 file changed, 13 insertions(+), 58 deletions(-)
|
||||
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
index 86dfc8409b5..29aa10d8225 100644
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -863,10 +863,8 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
|
||||
#endif
|
||||
{
|
||||
Header h;
|
||||
- char *debuginfo, **slot, *s, *s2;
|
||||
+ char *debuginfo, **slot;
|
||||
errmsg_t err;
|
||||
- size_t srcrpmlen = sizeof (".src.rpm") - 1;
|
||||
- size_t debuginfolen = sizeof ("-debuginfo") - 1;
|
||||
rpmdbMatchIterator mi_debuginfo;
|
||||
|
||||
h = rpmdbNextIterator_p (mi);
|
||||
@@ -875,7 +873,9 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
|
||||
|
||||
/* Verify the debuginfo file is not already installed. */
|
||||
|
||||
- debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
|
||||
+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
|
||||
+ debuginfo = headerFormat_p (h,
|
||||
+ "%{name}-debuginfo-%{version}-%{release}.%{arch}",
|
||||
&err);
|
||||
if (!debuginfo)
|
||||
{
|
||||
@@ -883,60 +883,19 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
|
||||
err);
|
||||
continue;
|
||||
}
|
||||
- /* s = `.src.rpm-debuginfo.%{arch}' */
|
||||
- s = strrchr (debuginfo, '-') - srcrpmlen;
|
||||
- s2 = NULL;
|
||||
- if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
|
||||
- {
|
||||
- /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||
- s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
|
||||
- }
|
||||
- if (s2)
|
||||
- {
|
||||
- /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||
- s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
|
||||
- }
|
||||
- if (!s2)
|
||||
- {
|
||||
- warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
- debuginfo);
|
||||
- xfree (debuginfo);
|
||||
- continue;
|
||||
- }
|
||||
- /* s = `.src.rpm-debuginfo.%{arch}' */
|
||||
- /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||
- memmove (s2 + debuginfolen, s2, s - s2);
|
||||
- memcpy (s2, "-debuginfo", debuginfolen);
|
||||
- /* s = `XXXX.%{arch}' */
|
||||
- /* strlen ("XXXX") == srcrpmlen + debuginfolen */
|
||||
- /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
|
||||
- /* strlen ("XX") == srcrpmlen */
|
||||
- memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
|
||||
- strlen (s + srcrpmlen + debuginfolen) + 1);
|
||||
- /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
|
||||
|
||||
+ /* Verify the debuginfo file is not already installed. */
|
||||
/* RPMDBI_PACKAGES requires keylen == sizeof (int). */
|
||||
/* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
|
||||
mi_debuginfo = rpmtsInitIterator_p (ts, (rpmDbiTagVal) RPMDBI_LABEL, debuginfo, 0);
|
||||
- xfree (debuginfo);
|
||||
if (mi_debuginfo)
|
||||
{
|
||||
+ xfree (debuginfo);
|
||||
rpmdbFreeIterator_p (mi_debuginfo);
|
||||
count = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
- /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
|
||||
- debuginfo = headerFormat_p (h,
|
||||
- "%{name}-%{version}-%{release}.%{arch}",
|
||||
- &err);
|
||||
- if (!debuginfo)
|
||||
- {
|
||||
- warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||
- err);
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
/* Base package name for `debuginfo-install'. We do not use the
|
||||
`yum' command directly as the line
|
||||
yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
|
||||
@@ -1085,10 +1044,7 @@ missing_rpm_list_print (void)
|
||||
missing_rpm_list_entries = 0;
|
||||
|
||||
gdb_printf (_("Missing separate debuginfos, use: %s"),
|
||||
-#ifdef DNF_DEBUGINFO_INSTALL
|
||||
- "dnf "
|
||||
-#endif
|
||||
- "debuginfo-install");
|
||||
+ "zypper install");
|
||||
for (const char *el : array)
|
||||
{
|
||||
gdb_printf (" %s", el);
|
||||
@@ -1295,13 +1251,12 @@ debug_print_missing (const char *binary, const char *debug)
|
||||
gdb_printf (gdb_stdlog,
|
||||
_("Missing separate debuginfo for %s\n"), binary);
|
||||
if (debug != NULL)
|
||||
- gdb_printf (gdb_stdlog, _("Try: %s %s\n"),
|
||||
-#ifdef DNF_DEBUGINFO_INSTALL
|
||||
- "dnf"
|
||||
-#else
|
||||
- "yum"
|
||||
-#endif
|
||||
- " --enablerepo='*debug*' install", debug);
|
||||
+ {
|
||||
+ const char *p = strrchr (debug, '/');
|
||||
+ gdb_printf (gdb_stdlog, _("Try: %s%.2s%.38s\"\n"),
|
||||
+ "zypper install -C \"debuginfo(build-id)=",
|
||||
+ p - 2, p + 1);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
base-commit: 91ac179279557e27e6a149cbb78e4052a348f109
|
||||
--
|
||||
2.35.3
|
||||
|
1082
gdb-6.6-buildid-locate-rpm.patch
Normal file
1082
gdb-6.6-buildid-locate-rpm.patch
Normal file
File diff suppressed because it is too large
Load Diff
238
gdb-6.6-buildid-locate-solib-missing-ids.patch
Normal file
238
gdb-6.6-buildid-locate-solib-missing-ids.patch
Normal file
@@ -0,0 +1,238 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-buildid-locate-solib-missing-ids.patch
|
||||
|
||||
;; Fix loading of core files without build-ids but with build-ids in executables.
|
||||
;; Load strictly build-id-checked core files only if no executable is specified
|
||||
;; (Jan Kratochvil, RH BZ 1339862).
|
||||
;;=push+jan
|
||||
|
||||
gdb returns an incorrect back trace when applying a debuginfo
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1339862
|
||||
|
||||
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
|
||||
--- a/gdb/solib-svr4.c
|
||||
+++ b/gdb/solib-svr4.c
|
||||
@@ -1321,14 +1321,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
}
|
||||
|
||||
{
|
||||
- struct bfd_build_id *build_id;
|
||||
+ struct bfd_build_id *build_id = NULL;
|
||||
|
||||
strncpy (newobj->so_original_name, buffer.get (), SO_NAME_MAX_PATH_SIZE - 1);
|
||||
newobj->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
||||
/* May get overwritten below. */
|
||||
strcpy (newobj->so_name, newobj->so_original_name);
|
||||
|
||||
- build_id = build_id_addr_get (((lm_info_svr4 *) newobj->lm_info)->l_ld);
|
||||
+ /* In the case the main executable was found according to its build-id
|
||||
+ (from a core file) prevent loading a different build of a library
|
||||
+ with accidentally the same SO_NAME.
|
||||
+
|
||||
+ It suppresses bogus backtraces (and prints "??" there instead) if
|
||||
+ the on-disk files no longer match the running program version.
|
||||
+
|
||||
+ If the main executable was not loaded according to its build-id do
|
||||
+ not do any build-id checking of the libraries. There may be missing
|
||||
+ build-ids dumped in the core file and we would map all the libraries
|
||||
+ to the only existing file loaded that time - the executable. */
|
||||
+ if (current_program_space->symfile_object_file != NULL
|
||||
+ && (current_program_space->symfile_object_file->flags
|
||||
+ & OBJF_BUILD_ID_CORE_LOADED) != 0)
|
||||
+ build_id = build_id_addr_get (li->l_ld);
|
||||
if (build_id != NULL)
|
||||
{
|
||||
char *name, *build_id_filename;
|
||||
@@ -1343,23 +1357,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
xfree (name);
|
||||
}
|
||||
else
|
||||
- {
|
||||
- debug_print_missing (newobj->so_name, build_id_filename);
|
||||
-
|
||||
- /* In the case the main executable was found according to
|
||||
- its build-id (from a core file) prevent loading
|
||||
- a different build of a library with accidentally the
|
||||
- same SO_NAME.
|
||||
-
|
||||
- It suppresses bogus backtraces (and prints "??" there
|
||||
- instead) if the on-disk files no longer match the
|
||||
- running program version. */
|
||||
-
|
||||
- if (current_program_space->symfile_object_file != NULL
|
||||
- && (current_program_space->symfile_object_file->flags
|
||||
- & OBJF_BUILD_ID_CORE_LOADED) != 0)
|
||||
- newobj->so_name[0] = 0;
|
||||
- }
|
||||
+ debug_print_missing (newobj->so_name, build_id_filename);
|
||||
|
||||
xfree (build_id_filename);
|
||||
xfree (build_id);
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ 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/>. */
|
||||
+
|
||||
+void
|
||||
+lib (void)
|
||||
+{
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ 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/>. */
|
||||
+
|
||||
+extern void lib (void);
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ lib ();
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
|
||||
@@ -0,0 +1,105 @@
|
||||
+# 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/>.
|
||||
+
|
||||
+if {[skip_shlib_tests]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "gcore-buildid-exec-but-not-solib"
|
||||
+set srcmainfile ${testfile}-main.c
|
||||
+set srclibfile ${testfile}-lib.c
|
||||
+set libfile [standard_output_file ${testfile}-lib.so]
|
||||
+set objfile [standard_output_file ${testfile}-main.o]
|
||||
+set executable ${testfile}-main
|
||||
+set binfile [standard_output_file ${executable}]
|
||||
+set gcorefile [standard_output_file ${executable}.gcore]
|
||||
+set outdir [file dirname $binfile]
|
||||
+
|
||||
+if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} "debug additional_flags=-Wl,--build-id"] != ""
|
||||
+ || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
|
||||
+ unsupported "-Wl,--build-id compilation failed"
|
||||
+ return -1
|
||||
+}
|
||||
+set opts [list debug shlib=${libfile} "additional_flags=-Wl,--build-id"]
|
||||
+if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
|
||||
+ unsupported "-Wl,--build-id compilation failed"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+gdb_load_shlib $libfile
|
||||
+
|
||||
+# Does this gdb support gcore?
|
||||
+set test "help gcore"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
|
||||
+ # gcore command not supported -- nothing to test here.
|
||||
+ unsupported "gdb does not support gcore on this target"
|
||||
+ return -1;
|
||||
+ }
|
||||
+ -re "Save a core file .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { ![runto lib] } then {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set escapedfilename [string_to_regexp ${gcorefile}]
|
||||
+
|
||||
+set test "save a corefile"
|
||||
+gdb_test_multiple "gcore ${gcorefile}" $test {
|
||||
+ -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Can't create a corefile\r\n$gdb_prompt $" {
|
||||
+ unsupported $test
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Now restart gdb and load the corefile.
|
||||
+
|
||||
+clean_restart $executable
|
||||
+gdb_load_shlib $libfile
|
||||
+
|
||||
+set buildid [build_id_debug_filename_get $libfile]
|
||||
+
|
||||
+regsub {\.debug$} $buildid {} buildid
|
||||
+
|
||||
+set debugdir [standard_output_file ${testfile}-debugdir]
|
||||
+file delete -force -- $debugdir
|
||||
+
|
||||
+file mkdir $debugdir/[file dirname $libfile]
|
||||
+file copy $libfile $debugdir/${libfile}
|
||||
+
|
||||
+file mkdir $debugdir/[file dirname $buildid]
|
||||
+file copy $libfile $debugdir/${buildid}
|
||||
+
|
||||
+remote_exec build "ln -s /lib ${debugdir}/"
|
||||
+remote_exec build "ln -s /lib64 ${debugdir}/"
|
||||
+# /usr is not needed, all the libs are in /lib64: libm.so.6 libc.so.6 ld-linux-x86-64.so.2
|
||||
+
|
||||
+gdb_test "set solib-absolute-prefix $debugdir"
|
||||
+
|
||||
+gdb_test_no_output "set debug-file-directory $debugdir" "set debug-file-directory"
|
||||
+
|
||||
+gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
|
||||
+
|
||||
+gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"
|
||||
+
|
||||
+gdb_test "bt"
|
||||
+gdb_test "info shared"
|
@@ -1,40 +0,0 @@
|
||||
From 4aaa960916b069dd82a293bf0e876dbc8710801e Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Wed, 26 Mar 2025 10:25:38 +0100
|
||||
Subject: [PATCH 4/4] gdb-6.6-buildid-locate-tests-suse.patch
|
||||
|
||||
---
|
||||
...z981154-misleading-yum-install-warning.exp | 20 ++++++++++++++++---
|
||||
1 file changed, 17 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
|
||||
index 991ffef474d..ab5f1667f31 100644
|
||||
--- a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
|
||||
+++ b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
|
||||
@@ -55,6 +55,20 @@ gdb_test "set build-id-verbose 1" "" \
|
||||
gdb_test "set debug-file-directory /usr/lib/" "" \
|
||||
"set debug-file-directory"
|
||||
|
||||
-gdb_test "core-file [standard_output_file gcore.test]" \
|
||||
- "Missing file\\(s\\), try: dnf --enablerepo='\\*debug\\*' install [string_to_regexp /usr/lib/$build_id_without_debug] [string_to_regexp /usr/lib/debug/$build_id_debug_file]" \
|
||||
- "test first yum/dnf warning"
|
||||
+# Supporting this for SUSE/openSUSE requires a gdb.missing_objfile handler,
|
||||
+# but that's not enabled. Zypper doesn't support finding packages based on
|
||||
+# build-id, unless the package's installed.
|
||||
+# So, instead of testing for the SUSE/openSUSE-specific solution, check that
|
||||
+# the fedora solution doesn't appear.
|
||||
+
|
||||
+set cmd "core-file [standard_output_file gcore.test]"
|
||||
+set test "test first yum/dnf warning"
|
||||
+set fail_re [string_to_regexp "Missing file(s), try: dnf "].*
|
||||
+gdb_test_multiple $cmd $test {
|
||||
+ -re -wrap $fail_re {
|
||||
+ fail $gdb_test_name
|
||||
+ }
|
||||
+ -re -wrap "" {
|
||||
+ pass $gdb_test_name
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.43.0
|
||||
|
1915
gdb-6.6-buildid-locate.patch
Normal file
1915
gdb-6.6-buildid-locate.patch
Normal file
File diff suppressed because it is too large
Load Diff
188
gdb-6.6-bz229517-gcore-without-terminal.patch
Normal file
188
gdb-6.6-bz229517-gcore-without-terminal.patch
Normal file
@@ -0,0 +1,188 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-bz229517-gcore-without-terminal.patch
|
||||
|
||||
;; Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
|
||||
;;=fedoratest
|
||||
|
||||
2007-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb_gcore.sh: Redirect GDB from `</dev/null'.
|
||||
|
||||
2007-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/gcorebg.exp, gdb.base/gcorebg.c: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gcorebg.c b/gdb/testsuite/gdb.base/gcorebg.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcorebg.c
|
||||
@@ -0,0 +1,49 @@
|
||||
+#include <stdio.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <unistd.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <signal.h>
|
||||
+#include <string.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+int main (int argc, char **argv)
|
||||
+{
|
||||
+ pid_t pid = 0;
|
||||
+ pid_t ppid;
|
||||
+ char buf[1024*2 + 500];
|
||||
+ int gotint;
|
||||
+
|
||||
+ if (argc != 4)
|
||||
+ {
|
||||
+ fprintf (stderr, "Syntax: %s {standard|detached} <gcore command> <core output file>\n",
|
||||
+ argv[0]);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ pid = fork ();
|
||||
+
|
||||
+ switch (pid)
|
||||
+ {
|
||||
+ case 0:
|
||||
+ if (strcmp (argv[1], "detached") == 0)
|
||||
+ setpgrp ();
|
||||
+ ppid = getppid ();
|
||||
+ gotint = snprintf (buf, sizeof (buf), "sh %s -o %s %d", argv[2], argv[3], (int) ppid);
|
||||
+ assert (gotint < sizeof (buf));
|
||||
+ system (buf);
|
||||
+ fprintf (stderr, "Killing parent PID %d\n", ppid);
|
||||
+ kill (ppid, SIGTERM);
|
||||
+ break;
|
||||
+
|
||||
+ case -1:
|
||||
+ perror ("fork err\n");
|
||||
+ exit (1);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ fprintf (stderr,"Sleeping as PID %d\n", getpid ());
|
||||
+ sleep (60);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gcorebg.exp b/gdb/testsuite/gdb.base/gcorebg.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcorebg.exp
|
||||
@@ -0,0 +1,113 @@
|
||||
+# Copyright 2007 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Please email any bugs, comments, and/or additions to this file to:
|
||||
+# bug-gdb@prep.ai.mit.edu
|
||||
+
|
||||
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+# This is a test for `gdb_gcore.sh' functionality.
|
||||
+# It also tests a regression with `gdb_gcore.sh' being run without its
|
||||
+# accessible terminal.
|
||||
+
|
||||
+if ![info exists GCORE] {
|
||||
+ set GCORE "[standard_output_file ../../../../gcore]"
|
||||
+}
|
||||
+verbose "using GCORE = $GCORE" 2
|
||||
+
|
||||
+set testfile "gcorebg"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+set corefile [standard_output_file ${testfile}.test]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested gcorebg.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Cleanup.
|
||||
+
|
||||
+proc core_clean {} {
|
||||
+ global corefile
|
||||
+
|
||||
+ foreach file [glob -nocomplain [join [list $corefile *] ""]] {
|
||||
+ verbose "Delete file $file" 1
|
||||
+ remote_file target delete $file
|
||||
+ }
|
||||
+}
|
||||
+core_clean
|
||||
+remote_file target delete "./gdb"
|
||||
+
|
||||
+# Generate the core file.
|
||||
+
|
||||
+# Provide `./gdb' for `gdb_gcore.sh' running it as a bare `gdb' command.
|
||||
+# Setup also `$PATH' appropriately.
|
||||
+# If GDB was not found let `gdb_gcore.sh' to find the system GDB by `$PATH'.
|
||||
+if {$GDB != "gdb"} {
|
||||
+ file link ./gdb $GDB
|
||||
+}
|
||||
+global env
|
||||
+set oldpath $env(PATH)
|
||||
+set env(PATH) [join [list . $env(PATH)] ":"]
|
||||
+verbose "PATH = $env(PATH)" 2
|
||||
+
|
||||
+# Test file body.
|
||||
+# $detached == "standard" || $detached == "detached"
|
||||
+
|
||||
+proc test_body { detached } {
|
||||
+ global binfile
|
||||
+ global GCORE
|
||||
+ global corefile
|
||||
+
|
||||
+ set res [remote_spawn target "$binfile $detached $GCORE $corefile"]
|
||||
+ if { $res < 0 || $res == "" } {
|
||||
+ fail "Spawning $detached gcore"
|
||||
+ return 1
|
||||
+ }
|
||||
+ pass "Spawning $detached gcore"
|
||||
+ remote_expect target 20 {
|
||||
+ timeout {
|
||||
+ fail "Spawned $detached gcore finished (timeout)"
|
||||
+ remote_exec target "kill -9 -[exp_pid -i $res]"
|
||||
+ return 1
|
||||
+ }
|
||||
+ "Saved corefile .*\r\nKilling parent PID " {
|
||||
+ pass "Spawned $detached gcore finished"
|
||||
+ remote_wait target 20
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if {1 == [llength [glob -nocomplain [join [list $corefile *] ""]]]} {
|
||||
+ pass "Core file generated by $detached gcore"
|
||||
+ } else {
|
||||
+ fail "Core file generated by $detached gcore"
|
||||
+ }
|
||||
+ core_clean
|
||||
+}
|
||||
+
|
||||
+# First a general `gdb_gcore.sh' spawn with its controlling terminal available.
|
||||
+
|
||||
+test_body standard
|
||||
+
|
||||
+# And now `gdb_gcore.sh' spawn without its controlling terminal available.
|
||||
+# It is spawned through `gcorebg.c' using setpgrp ().
|
||||
+
|
||||
+test_body detached
|
||||
+
|
||||
+
|
||||
+# Cleanup.
|
||||
+
|
||||
+set env(PATH) $oldpath
|
||||
+remote_file target delete "./gdb"
|
278
gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Normal file
278
gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Normal file
@@ -0,0 +1,278 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
|
||||
|
||||
;; Support for stepping over PPC atomic instruction sequences (BZ 237572).
|
||||
;;=fedoratest
|
||||
|
||||
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/atomic-seq-threaded.c,
|
||||
gdb.threads/atomic-seq-threaded.exp: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
|
||||
@@ -0,0 +1,171 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
+ MA 02110-1301, USA. */
|
||||
+
|
||||
+/* Test stepping over RISC atomic sequences.
|
||||
+ This variant testcases the code for stepping another thread while skipping
|
||||
+ over the atomic sequence in the former thread
|
||||
+ (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
|
||||
+ Code comes from gcc/testsuite/gcc.dg/sync-2.c */
|
||||
+
|
||||
+/* { dg-options "-march=i486" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
|
||||
+/* { dg-options "-mcpu=v9" { target sparc*-*-* } } */
|
||||
+
|
||||
+/* Test functionality of the intrinsics for 'short' and 'char'. */
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <pthread.h>
|
||||
+#include <assert.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#define LOOPS 2
|
||||
+
|
||||
+static int unused;
|
||||
+
|
||||
+static char AI[18];
|
||||
+static char init_qi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
|
||||
+static char test_qi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
|
||||
+
|
||||
+static void
|
||||
+do_qi (void)
|
||||
+{
|
||||
+ if (__sync_fetch_and_add(AI+4, 1) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AI+5, 4) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AI+6, 22) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_sub(AI+7, 12) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_and(AI+8, 7) != (char)-1)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_or(AI+9, 8) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_xor(AI+10, 9) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_nand(AI+11, 7) != 0)
|
||||
+ abort ();
|
||||
+
|
||||
+ if (__sync_add_and_fetch(AI+12, 1) != 1)
|
||||
+ abort ();
|
||||
+ if (__sync_sub_and_fetch(AI+13, 12) != (char)-12)
|
||||
+ abort ();
|
||||
+ if (__sync_and_and_fetch(AI+14, 7) != 7)
|
||||
+ abort ();
|
||||
+ if (__sync_or_and_fetch(AI+15, 8) != 8)
|
||||
+ abort ();
|
||||
+ if (__sync_xor_and_fetch(AI+16, 9) != 9)
|
||||
+ abort ();
|
||||
+ if (__sync_nand_and_fetch(AI+17, 7) != 7)
|
||||
+ abort ();
|
||||
+}
|
||||
+
|
||||
+static short AL[18];
|
||||
+static short init_hi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
|
||||
+static short test_hi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
|
||||
+
|
||||
+static void
|
||||
+do_hi (void)
|
||||
+{
|
||||
+ if (__sync_fetch_and_add(AL+4, 1) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AL+5, 4) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AL+6, 22) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_sub(AL+7, 12) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_and(AL+8, 7) != -1)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_or(AL+9, 8) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_xor(AL+10, 9) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_nand(AL+11, 7) != 0)
|
||||
+ abort ();
|
||||
+
|
||||
+ if (__sync_add_and_fetch(AL+12, 1) != 1)
|
||||
+ abort ();
|
||||
+ if (__sync_sub_and_fetch(AL+13, 12) != -12)
|
||||
+ abort ();
|
||||
+ if (__sync_and_and_fetch(AL+14, 7) != 7)
|
||||
+ abort ();
|
||||
+ if (__sync_or_and_fetch(AL+15, 8) != 8)
|
||||
+ abort ();
|
||||
+ if (__sync_xor_and_fetch(AL+16, 9) != 9)
|
||||
+ abort ();
|
||||
+ if (__sync_nand_and_fetch(AL+17, 7) != 7)
|
||||
+ abort ();
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+start1 (void *arg)
|
||||
+{
|
||||
+ unsigned loop;
|
||||
+ sleep(1);
|
||||
+
|
||||
+ for (loop = 0; loop < LOOPS; loop++)
|
||||
+ {
|
||||
+ memcpy(AI, init_qi, sizeof(init_qi));
|
||||
+
|
||||
+ do_qi ();
|
||||
+
|
||||
+ if (memcmp (AI, test_qi, sizeof(test_qi)))
|
||||
+ abort ();
|
||||
+ }
|
||||
+
|
||||
+ return arg; /* _delete1_ */
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+start2 (void *arg)
|
||||
+{
|
||||
+ unsigned loop;
|
||||
+
|
||||
+ for (loop = 0; loop < LOOPS; loop++)
|
||||
+ {
|
||||
+ memcpy(AL, init_hi, sizeof(init_hi));
|
||||
+
|
||||
+ do_hi ();
|
||||
+
|
||||
+ if (memcmp (AL, test_hi, sizeof(test_hi)))
|
||||
+ abort ();
|
||||
+ }
|
||||
+
|
||||
+ return arg; /* _delete2_ */
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ pthread_t thread;
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&thread, NULL, start1, NULL); /* _create_ */
|
||||
+ assert (i == 0); /* _create_after_ */
|
||||
+
|
||||
+ sleep (1);
|
||||
+
|
||||
+ start2 (NULL);
|
||||
+
|
||||
+ i = pthread_join (thread, NULL); /* _delete_ */
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ return 0; /* _exit_ */
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
|
||||
@@ -0,0 +1,84 @@
|
||||
+# atomic-seq-threaded.exp -- Test case for stepping over RISC atomic code seqs.
|
||||
+# This variant testcases the code for stepping another thread while skipping
|
||||
+# over the atomic sequence in the former thread
|
||||
+# (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
|
||||
+# Copyright (C) 2007 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+# Please email any bugs, comments, and/or additions to this file to:
|
||||
+# bug-gdb@prep.ai.mit.edu
|
||||
+
|
||||
+set testfile atomic-seq-threaded
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+foreach opts {{} {compiler=gcc4} {FAIL}} {
|
||||
+ if {$opts eq "FAIL"} {
|
||||
+ return -1
|
||||
+ }
|
||||
+ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $opts]] eq "" } {
|
||||
+ break
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+if ![runto_main] then {
|
||||
+ fail "Can't run to main"
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# pthread_create () will not pass even on x86_64 with software watchpoint.
|
||||
+# Pass after pthread_create () without any watchpoint active.
|
||||
+set line [gdb_get_line_number "_create_after_"]
|
||||
+gdb_test "tbreak $line" \
|
||||
+ "reakpoint (\[0-9\]+) at .*$srcfile, line $line\..*" \
|
||||
+ "set breakpoint after pthread_create ()"
|
||||
+gdb_test "c" \
|
||||
+ ".*/\\* _create_after_ \\*/.*" \
|
||||
+ "run till after pthread_create ()"
|
||||
+
|
||||
+# Without a watchpoint being software no single-stepping would be used.
|
||||
+set test "Start (software) watchpoint"
|
||||
+gdb_test_multiple "watch unused" $test {
|
||||
+ -re "Watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Hardware watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
|
||||
+ # We do not test the goal but still the whole testcase should pass.
|
||||
+ unsupported $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# More thorough testing of the scheduling logic.
|
||||
+gdb_test "set scheduler-locking step" ""
|
||||
+
|
||||
+# Critical code path is stepped through at this point.
|
||||
+set line [gdb_get_line_number "_exit_"]
|
||||
+gdb_test "tbreak $line" \
|
||||
+ "reakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \
|
||||
+ "set breakpoint at _exit_"
|
||||
+gdb_test "c" \
|
||||
+ ".*/\\* _exit_ \\*/.*" \
|
||||
+ "run till _exit_"
|
||||
+
|
||||
+# Just a nonproblematic program exit.
|
||||
+gdb_test "c" \
|
||||
+ ".*Program exited normally\\..*" \
|
||||
+ "run till program exit"
|
32
gdb-6.6-testsuite-timeouts.patch
Normal file
32
gdb-6.6-testsuite-timeouts.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.6-testsuite-timeouts.patch
|
||||
|
||||
;; Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
|
||||
--- a/gdb/testsuite/gdb.base/annota1.exp
|
||||
+++ b/gdb/testsuite/gdb.base/annota1.exp
|
||||
@@ -39,6 +39,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
|
||||
|
||||
clean_restart ${binfile}
|
||||
|
||||
+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
|
||||
+
|
||||
# The commands we test here produce many lines of output; disable "press
|
||||
# <return> to continue" prompts.
|
||||
gdb_test_no_output "set height 0"
|
||||
diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp
|
||||
--- a/gdb/testsuite/gdb.base/annota3.exp
|
||||
+++ b/gdb/testsuite/gdb.base/annota3.exp
|
||||
@@ -38,6 +38,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
|
||||
|
||||
clean_restart ${binfile}
|
||||
|
||||
+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
|
||||
+
|
||||
# The commands we test here produce many lines of output; disable "press
|
||||
# <return> to continue" prompts.
|
||||
gdb_test_no_output "set height 0"
|
104
gdb-6.7-testsuite-stable-results.patch
Normal file
104
gdb-6.7-testsuite-stable-results.patch
Normal file
@@ -0,0 +1,104 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.7-testsuite-stable-results.patch
|
||||
|
||||
;; Testsuite fixes for more stable/comparable results.
|
||||
;;=fedoratest
|
||||
|
||||
gdb/testsuite/gdb.base/fileio.c:
|
||||
gdb/testsuite/gdb.base/fileio.exp:
|
||||
2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/fileio.c (ROOTSUBDIR): New macro.
|
||||
(main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into
|
||||
ROOTSUBDIR if we are being run as root.
|
||||
* gdb.base/fileio.exp: Change the startup and finish cleanup.
|
||||
Change the test file reference to be into the `fileio.dir' directory.
|
||||
|
||||
sources/gdb/testsuite/gdb.base/dump.exp:
|
||||
Found on RHEL-5.s390x.
|
||||
|
||||
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
|
||||
random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
|
||||
|
||||
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
|
||||
frames-invalid can happen asynchronously.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
|
||||
--- a/gdb/testsuite/gdb.base/fileio.c
|
||||
+++ b/gdb/testsuite/gdb.base/fileio.c
|
||||
@@ -559,6 +559,28 @@ strerrno (int err)
|
||||
int
|
||||
main ()
|
||||
{
|
||||
+ /* These tests
|
||||
+ Open for write but no write permission returns EACCES
|
||||
+ Unlinking a file in a directory w/o write access returns EACCES
|
||||
+ fail if we are being run as root - drop the privileges here. */
|
||||
+
|
||||
+ if (geteuid () == 0)
|
||||
+ {
|
||||
+ uid_t uid = 99;
|
||||
+
|
||||
+ if (chown (OUTDIR, uid, uid) != 0)
|
||||
+ {
|
||||
+ printf ("chown %d.%d %s: %s\n", (int) uid, (int) uid,
|
||||
+ OUTDIR, strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ if (setuid (uid) || geteuid () == 0)
|
||||
+ {
|
||||
+ printf ("setuid %d: %s\n", (int) uid, strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Don't change the order of the calls. They partly depend on each other */
|
||||
test_open ();
|
||||
test_write ();
|
||||
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
|
||||
--- a/gdb/testsuite/gdb.base/fileio.exp
|
||||
+++ b/gdb/testsuite/gdb.base/fileio.exp
|
||||
@@ -24,9 +24,9 @@ if [target_info exists gdb,nofileio] {
|
||||
standard_testfile
|
||||
|
||||
if {[is_remote host]} {
|
||||
- set outdir .
|
||||
+ set outdir "fileio.dir"
|
||||
} else {
|
||||
- set outdir [standard_output_file {}]
|
||||
+ set outdir [standard_output_file "fileio.dir"]
|
||||
}
|
||||
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
|
||||
@@ -40,7 +40,8 @@ set dir2 [standard_output_file dir2.fileio.test]
|
||||
if {[file exists $dir2] && ![file writable $dir2]} {
|
||||
system "chmod +w $dir2"
|
||||
}
|
||||
-system "rm -rf [standard_output_file *.fileio.test]"
|
||||
+system "rm -rf [standard_output_file fileio.dir]"
|
||||
+system "mkdir -m777 [standard_output_file fileio.dir]"
|
||||
|
||||
set oldtimeout $timeout
|
||||
set timeout [expr "$timeout + 60"]
|
||||
@@ -81,7 +82,7 @@ gdb_test continue \
|
||||
|
||||
gdb_test "continue" ".*" ""
|
||||
|
||||
-catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\""
|
||||
+catch "system \"chmod -f -w [standard_output_file fileio.dir/nowrt.fileio.test]\""
|
||||
|
||||
gdb_test continue \
|
||||
"Continuing\\..*open 5:.*EACCES$stop_msg" \
|
||||
@@ -268,9 +269,7 @@ gdb_test continue \
|
||||
gdb_exit
|
||||
|
||||
# Make dir2 writable again so rm -rf of a build tree Just Works.
|
||||
-if {[file exists $dir2] && ![file writable $dir2]} {
|
||||
- system "chmod +w $dir2"
|
||||
-}
|
||||
+system "chmod -R +w $outdir"
|
||||
|
||||
set timeout $oldtimeout
|
||||
return 0
|
181
gdb-6.8-bz442765-threaded-exec-test.patch
Normal file
181
gdb-6.8-bz442765-threaded-exec-test.patch
Normal file
@@ -0,0 +1,181 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.8-bz442765-threaded-exec-test.patch
|
||||
|
||||
;; Test various forms of threads tracking across exec() (BZ 442765).
|
||||
;;=fedoratest
|
||||
|
||||
Test various forms of threads tracking across exec(2).
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
--- a/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
+++ b/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
@@ -18,21 +18,95 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stddef.h>
|
||||
-#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
+#ifdef THREADS
|
||||
+
|
||||
+# include <pthread.h>
|
||||
|
||||
static void *
|
||||
threader (void *arg)
|
||||
{
|
||||
- return NULL;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
-main (void)
|
||||
+main (int argc, char **argv)
|
||||
{
|
||||
+ char *exec_nothreads, *exec_threads, *cmd;
|
||||
+ int phase;
|
||||
+ char phase_s[8];
|
||||
+
|
||||
+ setbuf (stdout, NULL);
|
||||
+
|
||||
+ if (argc != 4)
|
||||
+ {
|
||||
+ fprintf (stderr, "%s <non-threaded> <threaded> <phase>\n", argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+#ifdef THREADS
|
||||
+ puts ("THREADS: Y");
|
||||
+#else
|
||||
+ puts ("THREADS: N");
|
||||
+#endif
|
||||
+ exec_nothreads = argv[1];
|
||||
+ printf ("exec_nothreads: %s\n", exec_nothreads);
|
||||
+ exec_threads = argv[2];
|
||||
+ printf ("exec_threads: %s\n", exec_threads);
|
||||
+ phase = atoi (argv[3]);
|
||||
+ printf ("phase: %d\n", phase);
|
||||
+
|
||||
+ /* Phases: threading
|
||||
+ 0: N -> N
|
||||
+ 1: N -> Y
|
||||
+ 2: Y -> Y
|
||||
+ 3: Y -> N
|
||||
+ 4: N -> exit */
|
||||
+
|
||||
+ cmd = NULL;
|
||||
+
|
||||
+#ifndef THREADS
|
||||
+ switch (phase)
|
||||
+ {
|
||||
+ case 0:
|
||||
+ cmd = exec_nothreads;
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ cmd = exec_threads;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
|
||||
+ phase);
|
||||
+ return 1;
|
||||
+ case 3:
|
||||
+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
|
||||
+ phase);
|
||||
+ return 1;
|
||||
+ case 4:
|
||||
+ return 0;
|
||||
+ default:
|
||||
+ assert (0);
|
||||
+ }
|
||||
+#else /* THREADS */
|
||||
+ switch (phase)
|
||||
+ {
|
||||
+ case 0:
|
||||
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
|
||||
+ argv[0], phase);
|
||||
+ return 1;
|
||||
+ case 1:
|
||||
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
|
||||
+ argv[0], phase);
|
||||
+ return 1;
|
||||
+ case 2:
|
||||
+ cmd = exec_threads;
|
||||
+ {
|
||||
pthread_t t1;
|
||||
int i;
|
||||
|
||||
@@ -40,7 +114,34 @@ main (void)
|
||||
assert (i == 0);
|
||||
i = pthread_join (t1, NULL);
|
||||
assert (i == 0);
|
||||
+ }
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ cmd = exec_nothreads;
|
||||
+ {
|
||||
+ pthread_t t1;
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&t1, NULL, threader, (void *) NULL);
|
||||
+ assert (i == 0);
|
||||
+ i = pthread_join (t1, NULL);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
|
||||
+ argv[0], phase);
|
||||
+ return 1;
|
||||
+ default:
|
||||
+ assert (0);
|
||||
+ }
|
||||
+#endif /* THREADS */
|
||||
+
|
||||
+ assert (cmd != NULL);
|
||||
+
|
||||
+ phase++;
|
||||
+ snprintf (phase_s, sizeof phase_s, "%d", phase);
|
||||
|
||||
- execl ("/bin/true", "/bin/true", NULL);
|
||||
- abort ();
|
||||
+ execl (cmd, cmd, exec_nothreads, exec_threads, phase_s, NULL);
|
||||
+ assert (0);
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp
|
||||
--- a/gdb/testsuite/gdb.threads/threaded-exec.exp
|
||||
+++ b/gdb/testsuite/gdb.threads/threaded-exec.exp
|
||||
@@ -20,9 +20,14 @@
|
||||
|
||||
set testfile threaded-exec
|
||||
set srcfile ${testfile}.c
|
||||
-set binfile [standard_output_file ${testfile}]
|
||||
+set binfile_nothreads [standard_output_file ${testfile}N]
|
||||
+set binfile_threads [standard_output_file ${testfile}Y]
|
||||
|
||||
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
|
||||
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_nothreads}" executable {additional_flags=-UTHREADS}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile_threads}" executable {additional_flags=-DTHREADS}] != "" } {
|
||||
return -1
|
||||
}
|
||||
|
||||
@@ -30,9 +35,9 @@ gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
|
||||
-gdb_load ${binfile}
|
||||
+gdb_load ${binfile_nothreads}
|
||||
|
||||
-gdb_run_cmd
|
||||
+gdb_run_cmd [list ${binfile_nothreads} ${binfile_threads} 0]
|
||||
|
||||
gdb_test_multiple {} "Program exited" {
|
||||
-re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {
|
@@ -1,71 +0,0 @@
|
||||
From 75397d995ffe1e1bbcfb75f9b4f744ba9c036d6d Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 15 Apr 2025 16:59:32 +0200
|
||||
Subject: [PATCH 1/2] [gdb/ada] Fix gdb.ada/overloads.exp on s390x
|
||||
|
||||
On s390x-linux, with test-case gdb.ada/overloads.exp and gcc 7.5.0 I run into:
|
||||
...
|
||||
(gdb) print Oload(CA)^M
|
||||
Could not find a match for oload^M
|
||||
(gdb) FAIL: $exp: print Oload(CA)
|
||||
...
|
||||
|
||||
The mismatch happens here in ada_type_match:
|
||||
...
|
||||
return ftype->code () == atype->code ();
|
||||
...
|
||||
with:
|
||||
...
|
||||
(gdb) p ftype->code ()
|
||||
$3 = TYPE_CODE_TYPEDEF
|
||||
(gdb) p atype->code ()
|
||||
$4 = TYPE_CODE_ARRAY
|
||||
...
|
||||
|
||||
At the start of ada_type_match, typedefs are skipped:
|
||||
...
|
||||
ftype = ada_check_typedef (ftype);
|
||||
atype = ada_check_typedef (atype);
|
||||
...
|
||||
but immediately after this, refs are skipped:
|
||||
...
|
||||
if (ftype->code () == TYPE_CODE_REF)
|
||||
ftype = ftype->target_type ();
|
||||
if (atype->code () == TYPE_CODE_REF)
|
||||
atype = atype->target_type ();
|
||||
...
|
||||
which in this case makes ftype a typedef.
|
||||
|
||||
Fix this by using ada_check_typedef after skipping the refs as well.
|
||||
|
||||
Tested on x86_64-linux and s390x-linux.
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
|
||||
PR ada/32409
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32409
|
||||
---
|
||||
gdb/ada-lang.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
|
||||
index fdb89cb0bb3..e9311c179b9 100644
|
||||
--- a/gdb/ada-lang.c
|
||||
+++ b/gdb/ada-lang.c
|
||||
@@ -3944,9 +3944,9 @@ ada_type_match (struct type *ftype, struct type *atype)
|
||||
atype = ada_check_typedef (atype);
|
||||
|
||||
if (ftype->code () == TYPE_CODE_REF)
|
||||
- ftype = ftype->target_type ();
|
||||
+ ftype = ada_check_typedef (ftype->target_type ());
|
||||
if (atype->code () == TYPE_CODE_REF)
|
||||
- atype = atype->target_type ();
|
||||
+ atype = ada_check_typedef (atype->target_type ());
|
||||
|
||||
switch (ftype->code ())
|
||||
{
|
||||
|
||||
base-commit: bb86ddf7c6827ec9b467cc0107395f91b9cbc5d2
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,198 +0,0 @@
|
||||
From 15d2ec49a716e217a031786034596fd0f0face6c Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 25 Mar 2025 14:12:51 +0100
|
||||
Subject: [PATCH 018/110] Update gdb-add-rpm-suggestion-script.patch for SUSE
|
||||
|
||||
---
|
||||
gdb/doc/gdb.texinfo | 126 +++++++++---------
|
||||
gdb/python/lib/gdb/command/rpm-suggestions.py | 12 +-
|
||||
2 files changed, 74 insertions(+), 64 deletions(-)
|
||||
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
index e9202b85f90..d7d8c772c35 100644
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -50355,15 +50355,19 @@ a hint before the next prompt is displayed:
|
||||
@smallexample
|
||||
(@value{GDBP}) file /bin/ls
|
||||
Reading symbols from /bin/ls...
|
||||
-Reading symbols from .gnu_debugdata for /usr/bin/ls...
|
||||
-(No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
|
||||
-Missing rpms, try: dnf --enablerepo='*debug*' install coreutils-debuginfo-9.3-7.fc39.x86_64
|
||||
+@c Reading symbols from .gnu_debugdata for /usr/bin/ls...
|
||||
+@c (No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
|
||||
+@c Missing rpms, try: dnf --enablerepo='*debug*' install coreutils-debuginfo-9.3-7.fc39.x86_64
|
||||
+(No debugging symbols found in /bin/ls)
|
||||
+Missing separate debuginfos, use: zypper install coreutils-debuginfo-8.32-150400.9.6.1.x86_64
|
||||
(@value{GDBP})
|
||||
@end smallexample
|
||||
|
||||
-In this case, installing @file{coreutils-debuginfo-9.3-7.fc39.x86_64}
|
||||
-will provide the missing debug information for @file{/bin/ls}. It is
|
||||
-up to you to install the suggested package, if possible, and after
|
||||
+@c In this case, installing @file{coreutils-debuginfo-9.3-7.fc39.x86_64}
|
||||
+@c will provide the missing debug information for @file{/bin/ls}.
|
||||
+In this case, installing @file{coreutils-debuginfo-8.32-150400.9.6.1.x86_64}
|
||||
+will provide the missing debug information for @file{/bin/ls}.
|
||||
+It is up to you to install the suggested package, if possible, and after
|
||||
that reload the executable in @value{GDBN} so that the newly installed
|
||||
debug information can be found.
|
||||
|
||||
@@ -50379,62 +50383,62 @@ When @samp{on} @value{GDBN} will make RPM suggestions where possible.
|
||||
When @samp{off} all RPM suggestion will be disabled.
|
||||
@end table
|
||||
|
||||
-When opening a core file (@pxref{core-file command}), it may be the
|
||||
-case that not only is the debug information missing, but the
|
||||
-corresponding executable itself is missing. For example, if a core
|
||||
-file is copied from one machine to another in order to debug.
|
||||
+@c When opening a core file (@pxref{core-file command}), it may be the
|
||||
+@c case that not only is the debug information missing, but the
|
||||
+@c corresponding executable itself is missing. For example, if a core
|
||||
+@c file is copied from one machine to another in order to debug.
|
||||
+
|
||||
+@c In this case @value{GDBN} is able to suggest a command which will
|
||||
+@c install the missing executable based on the build-id of the
|
||||
+@c executable. For example:
|
||||
+
|
||||
+@c @smallexample
|
||||
+@c (@value{GDBP}) core-file /tmp/core.5489
|
||||
+@c warning: Can't open file /usr/bin/sl during file-backed mapping note processing
|
||||
+@c [New LWP 5489]
|
||||
+@c Core was generated by `sl'.
|
||||
+@c Program terminated with signal SIGQUIT, Quit.
|
||||
+@c #0 0x00007f1b41ced1a7 in ?? ()
|
||||
+@c Missing file(s), try: dnf --enablerepo='*debug*' install /usr/lib/.build-id/33/2f1a8e56693960e3beb2d7@c 0cd79ddfec451cc3 /usr/lib/debug/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3.debug
|
||||
+@c (@value{GDBP})
|
||||
+@c @end smallexample
|
||||
+
|
||||
+@c The core file was generated from the @file{/usr/bin/sl} binary, which
|
||||
+@c is not present on the machine opening the core file. @value{GDBN} has
|
||||
+@c suggested a command, based on the build-id of the binary, which was
|
||||
+@c extracted from the core file, that would install both the missing
|
||||
+@c binary, and the corresponding debug information.
|
||||
+
|
||||
+@c Unfortunately, @value{GDBN} doesn't know if the suggested command will
|
||||
+@c actually find a matching RPM or not. Querying the RPM database to see
|
||||
+@c which packages, if any, will provide a file with the given build-id,
|
||||
+@c is rather slow. As @file{/usr/bin/sl} is available in an RPM, then
|
||||
+@c the above command will succeed.
|
||||
+
|
||||
+@c It is possible to have @value{GDBN} check to see if there is a package
|
||||
+@c available before making the suggestion, but this is significantly
|
||||
+@c slower. To enable this mode use the following command:
|
||||
|
||||
-In this case @value{GDBN} is able to suggest a command which will
|
||||
-install the missing executable based on the build-id of the
|
||||
-executable. For example:
|
||||
-
|
||||
-@smallexample
|
||||
-(@value{GDBP}) core-file /tmp/core.5489
|
||||
-warning: Can't open file /usr/bin/sl during file-backed mapping note processing
|
||||
-[New LWP 5489]
|
||||
-Core was generated by `sl'.
|
||||
-Program terminated with signal SIGQUIT, Quit.
|
||||
-#0 0x00007f1b41ced1a7 in ?? ()
|
||||
-Missing file(s), try: dnf --enablerepo='*debug*' install /usr/lib/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3 /usr/lib/debug/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3.debug
|
||||
-(@value{GDBP})
|
||||
-@end smallexample
|
||||
-
|
||||
-The core file was generated from the @file{/usr/bin/sl} binary, which
|
||||
-is not present on the machine opening the core file. @value{GDBN} has
|
||||
-suggested a command, based on the build-id of the binary, which was
|
||||
-extracted from the core file, that would install both the missing
|
||||
-binary, and the corresponding debug information.
|
||||
-
|
||||
-Unfortunately, @value{GDBN} doesn't know if the suggested command will
|
||||
-actually find a matching RPM or not. Querying the RPM database to see
|
||||
-which packages, if any, will provide a file with the given build-id,
|
||||
-is rather slow. As @file{/usr/bin/sl} is available in an RPM, then
|
||||
-the above command will succeed.
|
||||
-
|
||||
-It is possible to have @value{GDBN} check to see if there is a package
|
||||
-available before making the suggestion, but this is significantly
|
||||
-slower. To enable this mode use the following command:
|
||||
-
|
||||
-@table @code
|
||||
-@kindex set rpm-suggestion build-id-mode
|
||||
-@kindex show rpm-suggestion build-id-mode
|
||||
-@cindex rpm suggestions, build-id-mode
|
||||
-@item set rpm-suggestion build-id-mode @r{[}fast@r{|}slow@r{]}
|
||||
-@itemx show rpm-suggestion build-id-mode
|
||||
-When set to @samp{fast}, which is the default, @value{GDBN} will offer
|
||||
-suggestions based on the build-id of any missing executables or shared
|
||||
-libraries while opening a core file. This is fast, but @value{GDBN}
|
||||
-has not checked if there is a package available that can supply the
|
||||
-required file, so running the suggested command might not install any
|
||||
-packages.
|
||||
-
|
||||
-When set to @samp{slow}, each time @value{GDBN} encounters an
|
||||
-executable, or shared library, that is missing, @value{GDBN} will
|
||||
-check to see if there is an RPM available that will supply the missing
|
||||
-binary. If a suitable RPM is found then @value{GDBN} will offer a
|
||||
-command which will install the missing RPM. If no suitable RPM is
|
||||
-found then @value{GDBN} will make no suggestions.
|
||||
-@end table
|
||||
+@c @table @code
|
||||
+@c @kindex set rpm-suggestion build-id-mode
|
||||
+@c @kindex show rpm-suggestion build-id-mode
|
||||
+@c @cindex rpm suggestions, build-id-mode
|
||||
+@c @item set rpm-suggestion build-id-mode @r{[}fast@r{|}slow@r{]}
|
||||
+@c @itemx show rpm-suggestion build-id-mode
|
||||
+@c When set to @samp{fast}, which is the default, @value{GDBN} will offer
|
||||
+@c suggestions based on the build-id of any missing executables or shared
|
||||
+@c libraries while opening a core file. This is fast, but @value{GDBN}
|
||||
+@c has not checked if there is a package available that can supply the
|
||||
+@c required file, so running the suggested command might not install any
|
||||
+@c packages.
|
||||
+
|
||||
+@c When set to @samp{slow}, each time @value{GDBN} encounters an
|
||||
+@c executable, or shared library, that is missing, @value{GDBN} will
|
||||
+@c check to see if there is an RPM available that will supply the missing
|
||||
+@c binary. If a suitable RPM is found then @value{GDBN} will offer a
|
||||
+@c command which will install the missing RPM. If no suitable RPM is
|
||||
+@c found then @value{GDBN} will make no suggestions.
|
||||
+@c @end table
|
||||
|
||||
It is possible to review all of the previous RPM suggestions that
|
||||
@value{GDBN} has made using the following command:
|
||||
diff --git a/gdb/python/lib/gdb/command/rpm-suggestions.py b/gdb/python/lib/gdb/command/rpm-suggestions.py
|
||||
index d72db9c8015..4e119bb759e 100644
|
||||
--- a/gdb/python/lib/gdb/command/rpm-suggestions.py
|
||||
+++ b/gdb/python/lib/gdb/command/rpm-suggestions.py
|
||||
@@ -351,7 +351,7 @@ else:
|
||||
# Take a non-empty list of RPM names and print a command line a
|
||||
# user could run to install these RPMs.
|
||||
def print_rpm_suggestions(rpm_name_list):
|
||||
- print("Missing rpms, try: dnf --enablerepo='*debug*' install " + ' '.join(rpm_name_list))
|
||||
+ print("Missing separate debuginfos, use: zypper install " + ' '.join(rpm_name_list))
|
||||
|
||||
# Take a non-empty list of build-id strings and print a series of
|
||||
# lines that a user could run to instll the RPMs that provide
|
||||
@@ -416,7 +416,10 @@ else:
|
||||
|
||||
# Register the missing debug and missing objfile handlers with GDB.
|
||||
gdb.missing_debug.register_handler(None, RPM_MissingDebugHandler())
|
||||
- gdb.missing_objfile.register_handler(None, RPM_MissingObjfileHandler())
|
||||
+
|
||||
+ # Not enabled for SUSE/openSUSE. Zypper doesn't support finding packages
|
||||
+ # based on build-id, unless the package's installed.
|
||||
+ #gdb.missing_objfile.register_handler(None, RPM_MissingObjfileHandler())
|
||||
|
||||
# Implement the core of 'info rpm-suggestions'. Reprint all rpm
|
||||
# suggestions.
|
||||
@@ -518,7 +521,10 @@ class rpm_suggestion_info(gdb.Command):
|
||||
rpm_suggestion_set_prefix()
|
||||
rpm_suggestion_show_prefix()
|
||||
param_rpm_suggestion_enabled = rpm_suggestion_enabled()
|
||||
-param_rpm_suggestion_build_id_mode = rpm_suggestion_build_id_mode()
|
||||
+
|
||||
+# The rpm-suggestion build-id-mode is only relevant for
|
||||
+# RPM_MissingObjfileHandler, which is disabled for SUSE/openSUSE.
|
||||
+#param_rpm_suggestion_build_id_mode = rpm_suggestion_build_id_mode()
|
||||
|
||||
# Create the 'info rpm-suggestions' commands.
|
||||
rpm_suggestion_info()
|
||||
--
|
||||
2.43.0
|
||||
|
88
gdb-archer-next-over-throw-cxx-exec.patch
Normal file
88
gdb-archer-next-over-throw-cxx-exec.patch
Normal file
@@ -0,0 +1,88 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-archer-next-over-throw-cxx-exec.patch
|
||||
|
||||
;; Fix follow-exec for C++ programs (bugreported by Martin Stransky).
|
||||
;;=fedoratest
|
||||
|
||||
Archer-upstreamed:
|
||||
http://sourceware.org/ml/archer/2010-q2/msg00031.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/cxxexec.cc
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* This test script is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 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()
|
||||
+{
|
||||
+ execlp ("true", "true", NULL);
|
||||
+ return 1;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.cp/cxxexec.exp b/gdb/testsuite/gdb.cp/cxxexec.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/cxxexec.exp
|
||||
@@ -0,0 +1,42 @@
|
||||
+# Copyright 2010 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 { [skip_cplus_tests] } { continue }
|
||||
+
|
||||
+set testfile cxxexec
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+runto_main
|
||||
+
|
||||
+# We could stop after `continue' again at `main'.
|
||||
+delete_breakpoints
|
||||
+
|
||||
+set test "p _Unwind_DebugHook"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "\r\nNo symbol .*\r\n$gdb_prompt $" {
|
||||
+ xfail $test
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Run to end. The buggy GDB failed instead with:
|
||||
+# Cannot access memory at address ADDR.
|
||||
+gdb_continue_to_end "" "continue" 1
|
24
gdb-binutils29988-read_indexed_address.patch
Normal file
24
gdb-binutils29988-read_indexed_address.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Wed, 11 Jan 2023 12:13:46 +0000
|
||||
Subject: gdb-binutils29988-read_indexed_address.patch
|
||||
|
||||
;; Backport "Fix a potential illegal memory access in the BFD library..."
|
||||
;; (Nick Clifton, binutils/29988)
|
||||
|
||||
PR 29988
|
||||
* dwarf2.c (read_indexed_address): Fix check for an out of range
|
||||
offset.
|
||||
|
||||
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
|
||||
--- a/bfd/dwarf2.c
|
||||
+++ b/bfd/dwarf2.c
|
||||
@@ -1412,7 +1412,7 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)
|
||||
offset += unit->dwarf_addr_offset;
|
||||
if (offset < unit->dwarf_addr_offset
|
||||
|| offset > file->dwarf_addr_size
|
||||
- || file->dwarf_addr_size - offset < unit->offset_size)
|
||||
+ || file->dwarf_addr_size - offset < unit->addr_size)
|
||||
return 0;
|
||||
|
||||
info_ptr = file->dwarf_addr_buffer + offset;
|
@@ -1,92 +0,0 @@
|
||||
From 32a7b58de39da07e3449d90c31edb104e14480f1 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Burgess <aburgess@redhat.com>
|
||||
Date: Thu, 27 Feb 2025 11:31:02 +0000
|
||||
Subject: [PATCH 2/5] gdb: block SIGTERM during fetch_inferior_event
|
||||
|
||||
I'm posting this as RFC. I started looking at this when I got a CI
|
||||
failure email from Linaro about a regression on
|
||||
gdb.base/gdb-sigerm.exp on ARM. Turns out is wasn't my fault, it's
|
||||
just the precise failure point moves about, so it can look like a
|
||||
regression.
|
||||
|
||||
After looking at it for a bit I realised this was PR gdb/31061, and
|
||||
there have already been attempts to fix this over the last few years.
|
||||
|
||||
What I have here is different than any of the previous approaches
|
||||
posted, but I'm still not entirely sure this is the right solution,
|
||||
but I thought I'd share it. Might be nice to see if we can get this
|
||||
fixed.
|
||||
|
||||
The patch might still need some cleanup, but it should be good enough
|
||||
to discuss this approach.
|
||||
|
||||
Thanks,
|
||||
Andrew
|
||||
---
|
||||
gdb/infrun.c | 36 ++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 36 insertions(+)
|
||||
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
index 8a10119487c..cdce1c0b6c2 100644
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -78,6 +78,7 @@
|
||||
#include "extension.h"
|
||||
#include "disasm.h"
|
||||
#include "interps.h"
|
||||
+#include "gdbsupport/scoped_ignore_signal.h"
|
||||
|
||||
/* Prototypes for local functions */
|
||||
|
||||
@@ -4574,6 +4575,31 @@ infrun_quit_handler ()
|
||||
}
|
||||
}
|
||||
|
||||
+/* Block SIGTERM and then clear sync_quit_force_run. When we go out of
|
||||
+ scope, restore the previous sync_quit_force_run value, and then unblock
|
||||
+ signals.
|
||||
+
|
||||
+ This should maybe live in a support file somewhere, but it needs to see
|
||||
+ sync_quit_force_run, so likely needs to live in the gdb/ directory. */
|
||||
+
|
||||
+struct scoped_ignore_sigterm
|
||||
+{
|
||||
+ scoped_ignore_sigterm ()
|
||||
+ : m_old_val (sync_quit_force_run)
|
||||
+ {
|
||||
+ sync_quit_force_run = false;
|
||||
+ }
|
||||
+
|
||||
+ ~scoped_ignore_sigterm ()
|
||||
+ {
|
||||
+ sync_quit_force_run = m_old_val;
|
||||
+ }
|
||||
+
|
||||
+private:
|
||||
+ scoped_ignore_signal<SIGTERM, false> m_ignore_signal;
|
||||
+ bool m_old_val;
|
||||
+};
|
||||
+
|
||||
/* Asynchronous version of wait_for_inferior. It is called by the
|
||||
event loop whenever a change of state is detected on the file
|
||||
descriptor corresponding to the target. It can be called more than
|
||||
@@ -4609,6 +4635,16 @@ fetch_inferior_event ()
|
||||
scoped_restore restore_quit_handler
|
||||
= make_scoped_restore (&quit_handler, infrun_quit_handler);
|
||||
|
||||
+ /* Similar to how the above custom quit handler ignores the quit flag
|
||||
+ (thus not interrupting GDB on receipt of Ctrl-C), this arranges to
|
||||
+ block SIGTERM while we are handling the inferior event. Any SIGTERM
|
||||
+ will be deferred until this function is done. Usually SIGTERM is
|
||||
+ converted to an exception by the QUIT macro, but doing that while
|
||||
+ processing an inferior event can leave the inferior in a weird state,
|
||||
+ e.g. some breakpoints not removed. Deferring SIGTERM handling until
|
||||
+ after this function means the event should have been fully handled. */
|
||||
+ scoped_ignore_sigterm ignore_sigterm;
|
||||
+
|
||||
/* Make sure a SIGINT does not interrupt an extension language while
|
||||
we're handling an event. That could interrupt a Python unwinder
|
||||
or a Python observer or some such. A Ctrl-C should either be
|
||||
--
|
||||
2.43.0
|
||||
|
68
gdb-bz2237392-dwarf-obstack-allocation.patch
Normal file
68
gdb-bz2237392-dwarf-obstack-allocation.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Burgess <aburgess@redhat.com>
|
||||
Date: Thu, 14 Sep 2023 13:06:26 +0100
|
||||
Subject: gdb-bz2237392-dwarf-obstack-allocation.patch
|
||||
|
||||
;; Backport upstream commit 54392c4df604f20 to fix an incorrect
|
||||
;; obstack allocation that wold lead to memory corruption.
|
||||
|
||||
gdb: fix buffer overflow in DWARF reader
|
||||
|
||||
In this commit:
|
||||
|
||||
commit 48ac197b0c209ccf1f2de9704eb6cdf7c5c73a8e
|
||||
Date: Fri Nov 19 10:12:44 2021 -0700
|
||||
|
||||
Handle multiple addresses in call_site_target
|
||||
|
||||
a buffer overflow bug was introduced when the following code was
|
||||
added:
|
||||
|
||||
CORE_ADDR *saved = XOBNEWVAR (&objfile->objfile_obstack, CORE_ADDR,
|
||||
addresses.size ());
|
||||
std::copy (addresses.begin (), addresses.end (), saved);
|
||||
|
||||
The definition of XOBNEWVAR is (from libiberty.h):
|
||||
|
||||
#define XOBNEWVAR(O, T, S) ((T *) obstack_alloc ((O), (S)))
|
||||
|
||||
So 'saved' is going to point to addresses.size () bytes of memory,
|
||||
however, the std::copy will write addresses.size () number of
|
||||
CORE_ADDR sized entries to the address pointed to by 'saved', this is
|
||||
going to result in memory corruption.
|
||||
|
||||
The mistake is that we should have used XOBNEWVEC, which allocates a
|
||||
vector of entries, the definition of XOBNEWVEC is:
|
||||
|
||||
#define XOBNEWVEC(O, T, N) \
|
||||
((T *) obstack_alloc ((O), sizeof (T) * (N)))
|
||||
|
||||
Which means we will have set aside enough space to create a copy of
|
||||
the contents of the addresses vector.
|
||||
|
||||
I'm not sure how to create a test for this problem, this issue cropped
|
||||
up when debugging a particular i686 built binary, which just happened
|
||||
to trigger a glibc assertion (likely due to random memory corruption),
|
||||
debugging the same binary built for x86-64 appeared to work just fine.
|
||||
|
||||
Using valgrind on the failing GDB binary pointed straight to the cause
|
||||
of the problem, and with this patch in place there are no longer
|
||||
valgrind errors in this area.
|
||||
|
||||
If anyone has ideas for a test I'm happy to work on something.
|
||||
|
||||
Co-Authored-By: Keith Seitz <keiths@redhat.com>
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -12506,7 +12506,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
std::vector<CORE_ADDR> addresses;
|
||||
dwarf2_ranges_read_low_addrs (ranges_offset, target_cu,
|
||||
target_die->tag, addresses);
|
||||
- CORE_ADDR *saved = XOBNEWVAR (&objfile->objfile_obstack, CORE_ADDR,
|
||||
+ CORE_ADDR *saved = XOBNEWVEC (&objfile->objfile_obstack, CORE_ADDR,
|
||||
addresses.size ());
|
||||
std::copy (addresses.begin (), addresses.end (), saved);
|
||||
call_site->target.set_loc_array (addresses.size (), saved);
|
102
gdb-bz2237515-debuginfod-double-free.patch
Normal file
102
gdb-bz2237515-debuginfod-double-free.patch
Normal file
@@ -0,0 +1,102 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Tom Tromey <tromey@adacore.com>
|
||||
Date: Tue, 6 Dec 2022 12:07:12 -0700
|
||||
Subject: gdb-bz2237515-debuginfod-double-free.patch
|
||||
|
||||
;; Backport upstream commit f96328accde1e63 to fix a potential double
|
||||
;; free issue in the debuginfod code.
|
||||
|
||||
Avoid double-free with debuginfod
|
||||
|
||||
PR gdb/29257 points out a possible double free when debuginfod is in
|
||||
use. Aside from some ugly warts in the symbol code (an ongoing
|
||||
issue), the underlying issue in this particular case is that elfread.c
|
||||
seems to assume that symfile_bfd_open will return NULL on error,
|
||||
whereas in reality it throws an exception. As this code isn't
|
||||
prepared for an exception, bad things result.
|
||||
|
||||
This patch fixes the problem by introducing a non-throwing variant of
|
||||
symfile_bfd_open and using it in the affected places.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29257
|
||||
|
||||
diff --git a/gdb/elfread.c b/gdb/elfread.c
|
||||
--- a/gdb/elfread.c
|
||||
+++ b/gdb/elfread.c
|
||||
@@ -1222,10 +1222,12 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
|
||||
|
||||
if (!debugfile.empty ())
|
||||
{
|
||||
- gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (debugfile.c_str ()));
|
||||
+ gdb_bfd_ref_ptr debug_bfd
|
||||
+ (symfile_bfd_open_no_error (debugfile.c_str ()));
|
||||
|
||||
- symbol_file_add_separate (debug_bfd, debugfile.c_str (),
|
||||
- symfile_flags, objfile);
|
||||
+ if (debug_bfd != nullptr)
|
||||
+ symbol_file_add_separate (debug_bfd, debugfile.c_str (),
|
||||
+ symfile_flags, objfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1245,13 +1247,12 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
|
||||
if (fd.get () >= 0)
|
||||
{
|
||||
/* File successfully retrieved from server. */
|
||||
- gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (symfile_path.get ()));
|
||||
+ gdb_bfd_ref_ptr debug_bfd
|
||||
+ (symfile_bfd_open_no_error (symfile_path.get ()));
|
||||
|
||||
- if (debug_bfd == nullptr)
|
||||
- warning (_("File \"%s\" from debuginfod cannot be opened as bfd"),
|
||||
- filename);
|
||||
- else if (build_id_verify (debug_bfd.get (), build_id->size,
|
||||
- build_id->data))
|
||||
+ if (debug_bfd != nullptr
|
||||
+ && build_id_verify (debug_bfd.get (), build_id->size,
|
||||
+ build_id->data))
|
||||
{
|
||||
symbol_file_add_separate (debug_bfd, symfile_path.get (),
|
||||
symfile_flags, objfile);
|
||||
diff --git a/gdb/symfile.c b/gdb/symfile.c
|
||||
--- a/gdb/symfile.c
|
||||
+++ b/gdb/symfile.c
|
||||
@@ -1744,6 +1744,23 @@ symfile_bfd_open (const char *name)
|
||||
return sym_bfd;
|
||||
}
|
||||
|
||||
+/* See symfile.h. */
|
||||
+
|
||||
+gdb_bfd_ref_ptr
|
||||
+symfile_bfd_open_no_error (const char *name) noexcept
|
||||
+{
|
||||
+ try
|
||||
+ {
|
||||
+ return symfile_bfd_open (name);
|
||||
+ }
|
||||
+ catch (const gdb_exception_error &err)
|
||||
+ {
|
||||
+ warning ("%s", err.what ());
|
||||
+ }
|
||||
+
|
||||
+ return nullptr;
|
||||
+}
|
||||
+
|
||||
/* Return the section index for SECTION_NAME on OBJFILE. Return -1 if
|
||||
the section was not found. */
|
||||
|
||||
diff --git a/gdb/symfile.h b/gdb/symfile.h
|
||||
--- a/gdb/symfile.h
|
||||
+++ b/gdb/symfile.h
|
||||
@@ -269,6 +269,11 @@ extern void set_initial_language (void);
|
||||
|
||||
extern gdb_bfd_ref_ptr symfile_bfd_open (const char *);
|
||||
|
||||
+/* Like symfile_bfd_open, but will not throw an exception on error.
|
||||
+ Instead, it issues a warning and returns nullptr. */
|
||||
+
|
||||
+extern gdb_bfd_ref_ptr symfile_bfd_open_no_error (const char *) noexcept;
|
||||
+
|
||||
extern int get_section_index (struct objfile *, const char *);
|
||||
|
||||
extern int print_symbol_loading_p (int from_tty, int mainline, int full);
|
41
gdb-bz634108-solib_address.patch
Normal file
41
gdb-bz634108-solib_address.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-bz634108-solib_address.patch
|
||||
|
||||
;; Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108).
|
||||
;;=fedoratest
|
||||
|
||||
Fix gdb.solib_address (fix by Phil Muldoon).
|
||||
|
||||
s/solib_address/solib_name/ during upstreaming.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
@@ -0,0 +1,24 @@
|
||||
+# Copyright (C) 2008, 2009, 2010 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/>.
|
||||
+
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=634108
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+
|
||||
+# Skip all tests if Python scripting is not enabled.
|
||||
+if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+gdb_test "python print (gdb.solib_name(-1))" "None" "gdb.solib_name exists"
|
26
gdb-ccache-workaround.patch
Normal file
26
gdb-ccache-workaround.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-ccache-workaround.patch
|
||||
|
||||
;; Workaround ccache making lineno non-zero for command-line definitions.
|
||||
;;=fedoratest: ccache is rarely used and it is even fixed now.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
|
||||
--- a/gdb/testsuite/gdb.base/macscp.exp
|
||||
+++ b/gdb/testsuite/gdb.base/macscp.exp
|
||||
@@ -20,6 +20,14 @@ set objfile [standard_output_file ${testfile}.o]
|
||||
|
||||
set options {debug macros additional_flags=-DFROM_COMMANDLINE=ARG}
|
||||
|
||||
+# Workaround ccache making lineno non-zero for command-line definitions.
|
||||
+if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} {
|
||||
+ set result [catch "exec which gcc" output]
|
||||
+ if {$result == 0 && [string first "/ccache/" $output] > -1} {
|
||||
+ lappend options "compiler=/usr/bin/gcc"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
# Generate the intermediate object file. This is required by Darwin to
|
||||
# have access to the .debug_macinfo section.
|
||||
if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \
|
@@ -1,7 +1,4 @@
|
||||
From 6634dd948f02d1f7bd5c0a952899620276b1c260 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Mon, 7 Apr 2025 16:19:48 +0200
|
||||
Subject: [PATCH] [gdb/cli] Add ignore-errors command
|
||||
[gdb/cli] Add ignore-errors command
|
||||
|
||||
While trying to reproduce a failing test-case from the testsuite on the
|
||||
command line using a gdb command script, I ran into the problem that a command
|
||||
@@ -63,29 +60,28 @@ gdb/testsuite/ChangeLog:
|
||||
|
||||
* gdb.base/ignore-errors.exp: New test.
|
||||
* gdb.base/ignore-errors.gdb: New command file.
|
||||
|
||||
---
|
||||
gdb/cli/cli-cmds.c | 35 ++++++++++++++++++++++++
|
||||
gdb/doc/gdb.texinfo | 8 +++++-
|
||||
gdb/testsuite/gdb.base/ignore-errors.exp | 24 ++++++++++++++++
|
||||
gdb/cli/cli-cmds.c | 35 ++++++++++++++++++++++++++++++++
|
||||
gdb/doc/gdb.texinfo | 8 +++++++-
|
||||
gdb/testsuite/gdb.base/ignore-errors.exp | 24 ++++++++++++++++++++++
|
||||
gdb/testsuite/gdb.base/ignore-errors.gdb | 2 ++
|
||||
4 files changed, 68 insertions(+), 1 deletion(-)
|
||||
create mode 100644 gdb/testsuite/gdb.base/ignore-errors.exp
|
||||
create mode 100644 gdb/testsuite/gdb.base/ignore-errors.gdb
|
||||
|
||||
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
|
||||
index 0140c717ca2..c244eebbdf7 100644
|
||||
index 31d398cb13b..4eff591b3df 100644
|
||||
--- a/gdb/cli/cli-cmds.c
|
||||
+++ b/gdb/cli/cli-cmds.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "gdbsupport/filestuff.h"
|
||||
#include "location.h"
|
||||
#include "block.h"
|
||||
#include "valprint.h"
|
||||
+#include "event-top.h"
|
||||
|
||||
#include "ui-out.h"
|
||||
#include "interps.h"
|
||||
@@ -2572,6 +2573,34 @@ shell_internal_fn (struct gdbarch *gdbarch,
|
||||
return value::allocate_optimized_out (int_type);
|
||||
@@ -2399,6 +2400,34 @@ gdb_maint_setting_str_internal_fn (struct gdbarch *gdbarch,
|
||||
return str_value_from_setting (*show_cmd->var, gdbarch);
|
||||
}
|
||||
|
||||
+/* Completer for "ignore-errors". */
|
||||
@@ -119,10 +115,10 @@ index 0140c717ca2..c244eebbdf7 100644
|
||||
void _initialize_cli_cmds ();
|
||||
void
|
||||
_initialize_cli_cmds ()
|
||||
@@ -2972,4 +3001,10 @@ when GDB is started."), GDBINIT).release ();
|
||||
@@ -2786,4 +2815,10 @@ when GDB is started."), GDBINIT).release ();
|
||||
c = add_cmd ("source", class_support, source_command,
|
||||
source_help_text, &cmdlist);
|
||||
set_cmd_completer (c, deprecated_filename_completer);
|
||||
set_cmd_completer (c, filename_completer);
|
||||
+
|
||||
+ c = add_cmd ("ignore-errors", class_support, ignore_errors_command,
|
||||
+ _("Execute a single command, ignoring all errors.\n"
|
||||
@@ -131,10 +127,10 @@ index 0140c717ca2..c244eebbdf7 100644
|
||||
+ set_cmd_completer (c, ignore_errors_command_completer);
|
||||
}
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
index 47c538520ab..b830d42da72 100644
|
||||
index 1cf3550885e..68e11585942 100644
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -29472,7 +29472,8 @@ The lines in a command file are generally executed sequentially,
|
||||
@@ -27680,7 +27680,8 @@ The lines in a command file are generally executed sequentially,
|
||||
unless the order of execution is changed by one of the
|
||||
@emph{flow-control commands} described below. The commands are not
|
||||
printed as they are executed. An error in any command terminates
|
||||
@@ -144,7 +140,7 @@ index 47c538520ab..b830d42da72 100644
|
||||
|
||||
@value{GDBN} first searches for @var{filename} in the current directory.
|
||||
If the file is not found there, and @var{filename} does not specify a
|
||||
@@ -29567,6 +29568,11 @@ the controlling expression.
|
||||
@@ -27775,6 +27776,11 @@ the controlling expression.
|
||||
@item end
|
||||
Terminate the block of commands that are the body of @code{if},
|
||||
@code{else}, or @code{while} flow-control commands.
|
||||
@@ -194,8 +190,3 @@ index 00000000000..5962ff49b11
|
||||
@@ -0,0 +1,2 @@
|
||||
+ignore-errors run
|
||||
+echo here\n
|
||||
|
||||
base-commit: 1398f45a2641e0e9e0e331681655404ae1d4ed97
|
||||
--
|
||||
2.43.0
|
||||
|
||||
|
69
gdb-cli-handle-pending-c-after-rl_callback_read_char.patch
Normal file
69
gdb-cli-handle-pending-c-after-rl_callback_read_char.patch
Normal file
@@ -0,0 +1,69 @@
|
||||
From 3f5ef7bf512c7565279832bad3d5c743e9d8ae4b Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Wed, 24 May 2023 10:53:02 +0200
|
||||
Subject: [PATCH 1/4] [gdb/cli] Handle pending ^C after rl_callback_read_char
|
||||
for readline 7
|
||||
|
||||
In commit faf01aee1d0 ("[gdb] Handle pending ^C after rl_callback_read_char")
|
||||
we handled a problem (described in detail in that commit) for readline >= 8
|
||||
using public readline functions rl_pending_signal and rl_check_signals.
|
||||
|
||||
For readline 7 (note that we require at least readline 7 so there's no need to
|
||||
worry about readline 6), there was no fix though, because rl_check_signals was
|
||||
not available.
|
||||
|
||||
Fix this by instead using the private readline function _rl_signal_handler.
|
||||
|
||||
There is precedent for using private readline variables and functions, but
|
||||
it's something we want to get rid of (PR build/10723). Nevertheless, I think
|
||||
we can allow this specific instance because it's not used when building
|
||||
against readline >= 8.
|
||||
|
||||
[ In the meanwhile, a fix was committed in the devel branch of the readline
|
||||
repo, contained in commit 8d0c439 ("rollup of changes since readline-8.2"),
|
||||
first proposed here (
|
||||
https://lists.gnu.org/archive/html/bug-readline/2022-10/msg00008.html ). ]
|
||||
|
||||
Tested on x86_64-linux, against system readline 7.0 on openSUSE Leap 15.4.
|
||||
|
||||
PR cli/27813
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27813
|
||||
---
|
||||
gdb/event-top.c | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/event-top.c b/gdb/event-top.c
|
||||
index 9181e4bdcff..399582698c1 100644
|
||||
--- a/gdb/event-top.c
|
||||
+++ b/gdb/event-top.c
|
||||
@@ -134,6 +134,9 @@ static struct async_signal_handler *async_sigterm_token;
|
||||
character is processed. */
|
||||
void (*after_char_processing_hook) (void);
|
||||
|
||||
+#if RL_VERSION_MAJOR == 7
|
||||
+EXTERN_C void _rl_signal_handler (int);
|
||||
+#endif
|
||||
|
||||
/* Wrapper function for calling into the readline library. This takes
|
||||
care of a couple things:
|
||||
@@ -200,8 +203,14 @@ gdb_rl_callback_read_char_wrapper_noexcept () noexcept
|
||||
pending signal. I'm not sure if that's possible, but it seems
|
||||
better to handle the scenario than to assert. */
|
||||
rl_check_signals ();
|
||||
+#elif RL_VERSION_MAJOR == 7
|
||||
+ /* Unfortunately, rl_check_signals is not available. Use private
|
||||
+ function _rl_signal_handler instead. */
|
||||
+
|
||||
+ while (rl_pending_signal () != 0)
|
||||
+ _rl_signal_handler (rl_pending_signal ());
|
||||
#else
|
||||
- /* Unfortunately, rl_check_signals is not available. */
|
||||
+#error "Readline major version >= 7 expected"
|
||||
#endif
|
||||
if (after_char_processing_hook)
|
||||
(*after_char_processing_hook) ();
|
||||
|
||||
base-commit: 7f7fcd7031430953f41b284069d1ed0cf3c8734a
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -1,41 +0,0 @@
|
||||
From 442c996a4de355459eeabd280649ddb282d7de41 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Sat, 25 Jan 2025 10:08:53 +0100
|
||||
Subject: [PATCH 2/2] [gdb/cli] Print AT_HWCAP3 and AT_HWCAP4
|
||||
|
||||
PR cli/32590
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32590
|
||||
---
|
||||
gdb/auxv.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/gdb/auxv.c b/gdb/auxv.c
|
||||
index 8cda0b687b4..bb4c7ea70a0 100644
|
||||
--- a/gdb/auxv.c
|
||||
+++ b/gdb/auxv.c
|
||||
@@ -453,6 +453,13 @@ fprint_auxv_entry (struct ui_file *file, const char *name,
|
||||
}
|
||||
}
|
||||
|
||||
+#ifndef AT_HWCAP3
|
||||
+#define AT_HWCAP3 29
|
||||
+#endif
|
||||
+#ifndef AT_HWCAP4
|
||||
+#define AT_HWCAP4 30
|
||||
+#endif
|
||||
+
|
||||
/* The default implementation of gdbarch_print_auxv_entry. */
|
||||
|
||||
void
|
||||
@@ -495,6 +502,8 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
|
||||
AUXV_FORMAT_STR);
|
||||
TAG (AT_RANDOM, _("Address of 16 random bytes"), AUXV_FORMAT_HEX);
|
||||
TAG (AT_HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
|
||||
+ TAG (AT_HWCAP3, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
|
||||
+ TAG (AT_HWCAP4, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
|
||||
TAG (AT_RSEQ_FEATURE_SIZE, _("rseq supported feature size"),
|
||||
AUXV_FORMAT_DEC);
|
||||
TAG (AT_RSEQ_ALIGN, _("rseq allocation alignment"),
|
||||
--
|
||||
2.43.0
|
||||
|
58
gdb-core-open-vdso-warning.patch
Normal file
58
gdb-core-open-vdso-warning.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-core-open-vdso-warning.patch
|
||||
|
||||
;; Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
|
||||
;; Fix regression of undisplayed missing shared libraries caused by a fix for.
|
||||
;;=fedoratest: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*>
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html
|
||||
Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
|
||||
|
||||
[ New patch variant. ]
|
||||
|
||||
commit 7d760051ffb8a23cdc51342d4e6243fbc462f73f
|
||||
Author: Ulrich Weigand <uweigand@de.ibm.com>
|
||||
Date: Wed Sep 25 11:52:50 2013 +0000
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
|
||||
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
|
||||
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
|
||||
@@ -29,6 +29,7 @@ set testfile "solib-symbol-main"
|
||||
set srcfile ${srcdir}/${subdir}/${testfile}.c
|
||||
set binfile [standard_output_file ${testfile}]
|
||||
set bin_flags [list debug shlib=${binfile_lib}]
|
||||
+set executable ${testfile}
|
||||
|
||||
if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
|
||||
|| [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
|
||||
@@ -66,8 +67,26 @@ gdb_test "br foo2" \
|
||||
"Breakpoint.*: foo2. .2 locations..*" \
|
||||
"foo2 in mdlib"
|
||||
|
||||
-gdb_exit
|
||||
+# Test GDB warns for shared libraris which have not been found.
|
||||
|
||||
-return 0
|
||||
+gdb_test "info sharedlibrary" "/${libname}.*"
|
||||
|
||||
+clean_restart ${executable}
|
||||
+gdb_breakpoint "main"
|
||||
+gdb_run_cmd
|
||||
+set test "no warning for missing libraries"
|
||||
+gdb_test_multiple "" $test {
|
||||
+ -re "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re "Breakpoint \[0-9\]+, main .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
|
||||
+clean_restart ${executable}
|
||||
+gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST"
|
||||
+gdb_breakpoint "main"
|
||||
+gdb_run_cmd
|
||||
+gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \
|
||||
+ "warning for missing libraries"
|
@@ -1,61 +0,0 @@
|
||||
From b57066d1eaafab3100a8d7d788feba5802c409b7 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Mon, 27 Jan 2025 10:33:28 +0100
|
||||
Subject: [PATCH] [gdb/doc] Fix gdb.unwinder docs
|
||||
|
||||
When building gdb with an older makeinfo (4.13), I run into:
|
||||
...
|
||||
gdb/doc/python.texi:3015: warning: `(' follows defined name \
|
||||
`gdb.unwinder.Unwinder.__init__' instead of whitespace.
|
||||
gdb/doc/python.texi:3041: warning: `(' follows defined name \
|
||||
`gdb.unwinder.FrameId.__init__' instead of whitespace.
|
||||
...
|
||||
|
||||
The warnings are related to these two lines:
|
||||
...
|
||||
@defun gdb.unwinder.Unwinder.__init__(name)
|
||||
...
|
||||
@defun gdb.unwinder.FrameId.__init__(sp, pc, special = @code{None})
|
||||
...
|
||||
|
||||
Indeed, when checking the command and variable index, we can see that it
|
||||
contains an incorrect entry:
|
||||
...
|
||||
gdb.unwinder.FrameId.__init__(sp,: Unwinding Frames in Python
|
||||
...
|
||||
|
||||
Fix this by adding a space before the left parenthesis.
|
||||
|
||||
Tested by rebuilding the documentation and checking the command and variable
|
||||
index.
|
||||
---
|
||||
gdb/doc/python.texi | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
|
||||
index e49cc580b1b..58904298c71 100644
|
||||
--- a/gdb/doc/python.texi
|
||||
+++ b/gdb/doc/python.texi
|
||||
@@ -3011,7 +3011,7 @@ unwinders can derive, though it is not required that unwinders derive
|
||||
from this class, so long as any user created unwinder has the required
|
||||
@code{name} and @code{enabled} attributes.
|
||||
|
||||
-@defun gdb.unwinder.Unwinder.__init__(name)
|
||||
+@defun gdb.unwinder.Unwinder.__init__ (name)
|
||||
The @var{name} is a string used to reference this unwinder within some
|
||||
@value{GDBN} commands (@pxref{Managing Registered Unwinders}).
|
||||
@end defun
|
||||
@@ -3037,7 +3037,7 @@ most cases this class will be sufficient.
|
||||
|
||||
@code{gdb.unwinder.FrameId} has the following method:
|
||||
|
||||
-@defun gdb.unwinder.FrameId.__init__(sp, pc, special = @code{None})
|
||||
+@defun gdb.unwinder.FrameId.__init__ (sp, pc, special = @code{None})
|
||||
The @var{sp} and @var{pc} arguments are required and should be either
|
||||
a @code{gdb.Value} object, or an integer.
|
||||
|
||||
|
||||
base-commit: fe0e6edbcb65ab5eca50c1a0ad8ddc9844f8ea98
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,41 +0,0 @@
|
||||
From c23182d85ad9b5b6a45ba74993de55eac00a71bc Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Mon, 27 Jan 2025 11:22:12 +0100
|
||||
Subject: [PATCH] [gdb/doc] Fix qIsAddressTagged anchor
|
||||
|
||||
When building gdb with an older makeinfo (4.13), I run into:
|
||||
...
|
||||
gdb/doc/gdb.texinfo:44159: @anchor expected braces.
|
||||
gdb/doc/gdb.texinfo:44159: ` {qIsAddressTagged}
|
||||
...
|
||||
|
||||
This is related to this line:
|
||||
...
|
||||
@anchor {qIsAddressTagged}
|
||||
...
|
||||
|
||||
Fix this by removing the space before the left brace.
|
||||
|
||||
Tested by rebuilding the documentation.
|
||||
---
|
||||
gdb/doc/gdb.texinfo | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
index 6b08838862c..97508863776 100644
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -44156,7 +44156,7 @@ tags found in the requested memory range.
|
||||
@cindex check if a given address is in a memory tagged region
|
||||
@cindex @samp{qIsAddressTagged} packet
|
||||
@item qIsAddressTagged:@var{address}
|
||||
-@anchor {qIsAddressTagged}
|
||||
+@anchor{qIsAddressTagged}
|
||||
Check if address @var{address} is in a memory tagged region; if it is, it's
|
||||
said to be @dfn{tagged}. The target is responsible for checking it, as this
|
||||
is architecture-specific.
|
||||
|
||||
base-commit: 3e2d8d7edd244dd5a82588c3e7145c47c7b539ab
|
||||
--
|
||||
2.43.0
|
||||
|
@@ -1,44 +0,0 @@
|
||||
From 2004e74e0e28ed0b762d98380972b1e6984b9c46 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 28 Jan 2025 08:01:46 +0100
|
||||
Subject: [PATCH] [gdb/doc] Fix "Standard Replies" xref
|
||||
|
||||
When building gdb with an older makeinfo (4.13), I run into:
|
||||
...
|
||||
gdb/doc/gdb.texinfo:42613: warning: `.' or `,' must follow @xref, not `f'.
|
||||
...
|
||||
|
||||
This is related to this line:
|
||||
...
|
||||
@xref{Standard Replies} for standard error responses, and how to
|
||||
respond indicating a command is not supported.
|
||||
...
|
||||
|
||||
Fix this by adding a comma.
|
||||
|
||||
Tested by rebuilding the docs.
|
||||
|
||||
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
|
||||
Co-Authored-By: Eli Zaretskii <eliz@gnu.org>
|
||||
---
|
||||
gdb/doc/gdb.texinfo | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
index e5d562c00b4..0bfe6be6126 100644
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -42610,7 +42610,7 @@ seven repeats (@samp{$}) can be expanded using a repeat count of only
|
||||
five (@samp{"}). For example, @samp{00000000} can be encoded as
|
||||
@samp{0*"00}.
|
||||
|
||||
-@xref{Standard Replies} for standard error responses, and how to
|
||||
+@xref{Standard Replies}, for standard error responses, and how to
|
||||
respond indicating a command is not supported.
|
||||
|
||||
In describing packets (commands and responses), each description has a
|
||||
|
||||
base-commit: 7992b582e5a55bf2fd64f2f94b854d335c36c6a5
|
||||
--
|
||||
2.43.0
|
||||
|
71
gdb-fedora-libncursesw.patch
Normal file
71
gdb-fedora-libncursesw.patch
Normal file
@@ -0,0 +1,71 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-fedora-libncursesw.patch
|
||||
|
||||
;; Force libncursesw over libncurses to match the includes (RH BZ 1270534).
|
||||
;;=push+jan
|
||||
|
||||
Fedora: Force libncursesw over libncurses to match the includes.
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1270534
|
||||
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -20915,6 +20915,7 @@ if test x"$prefer_curses" = xyes; then
|
||||
# search /usr/local/include, if ncurses is installed in /usr/local. A
|
||||
# default installation of ncurses on alpha*-dec-osf* will lead to such
|
||||
# a situation.
|
||||
+ # Fedora: Force libncursesw over libncurses to match the includes.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
|
||||
$as_echo_n "checking for library containing waddstr... " >&6; }
|
||||
if ${ac_cv_search_waddstr+:} false; then :
|
||||
@@ -20939,7 +20940,7 @@ return waddstr ();
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
-for ac_lib in '' ncursesw ncurses cursesX curses; do
|
||||
+for ac_lib in '' ncursesw; do
|
||||
if test -z "$ac_lib"; then
|
||||
ac_res="none required"
|
||||
else
|
||||
@@ -21013,6 +21014,7 @@ case $host_os in
|
||||
esac
|
||||
|
||||
# These are the libraries checked by Readline.
|
||||
+# Fedora: Force libncursesw over libncurses to match the includes.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
|
||||
$as_echo_n "checking for library containing tgetent... " >&6; }
|
||||
if ${ac_cv_search_tgetent+:} false; then :
|
||||
@@ -21037,7 +21039,7 @@ return tgetent ();
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
-for ac_lib in '' termcap tinfow tinfo curses ncursesw ncurses; do
|
||||
+for ac_lib in '' ncursesw; do
|
||||
if test -z "$ac_lib"; then
|
||||
ac_res="none required"
|
||||
else
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -704,7 +704,8 @@ if test x"$prefer_curses" = xyes; then
|
||||
# search /usr/local/include, if ncurses is installed in /usr/local. A
|
||||
# default installation of ncurses on alpha*-dec-osf* will lead to such
|
||||
# a situation.
|
||||
- AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses])
|
||||
+ # Fedora: Force libncursesw over libncurses to match the includes.
|
||||
+ AC_SEARCH_LIBS(waddstr, [ncursesw])
|
||||
|
||||
if test "$ac_cv_search_waddstr" != no; then
|
||||
curses_found=yes
|
||||
@@ -746,7 +747,8 @@ case $host_os in
|
||||
esac
|
||||
|
||||
# These are the libraries checked by Readline.
|
||||
-AC_SEARCH_LIBS(tgetent, [termcap tinfow tinfo curses ncursesw ncurses])
|
||||
+# Fedora: Force libncursesw over libncurses to match the includes.
|
||||
+AC_SEARCH_LIBS(tgetent, [ncursesw])
|
||||
|
||||
if test "$ac_cv_search_tgetent" = no; then
|
||||
CONFIG_OBS="$CONFIG_OBS stub-termcap.o"
|
645
gdb-fix-segfault-in-for_each_block-part-1.patch
Normal file
645
gdb-fix-segfault-in-for_each_block-part-1.patch
Normal file
@@ -0,0 +1,645 @@
|
||||
From 75617e6d28b93814ac46ad85ad4fc2b133f61114 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Fri, 3 Nov 2023 16:25:33 +0100
|
||||
Subject: [PATCH] [gdb] Fix segfault in for_each_block, part 1
|
||||
|
||||
When running test-case gdb.base/vfork-follow-parent.exp on powerpc64 (likewise
|
||||
on s390x), I run into:
|
||||
...
|
||||
(gdb) PASS: gdb.base/vfork-follow-parent.exp: \
|
||||
exec_file=vfork-follow-parent-exit: target-non-stop=on: non-stop=off: \
|
||||
resolution_method=schedule-multiple: print unblock_parent = 1
|
||||
continue^M
|
||||
Continuing.^M
|
||||
Reading symbols from vfork-follow-parent-exit...^M
|
||||
^M
|
||||
^M
|
||||
Fatal signal: Segmentation fault^M
|
||||
----- Backtrace -----^M
|
||||
0x1027d3e7 gdb_internal_backtrace_1^M
|
||||
src/gdb/bt-utils.c:122^M
|
||||
0x1027d54f _Z22gdb_internal_backtracev^M
|
||||
src/gdb/bt-utils.c:168^M
|
||||
0x1057643f handle_fatal_signal^M
|
||||
src/gdb/event-top.c:889^M
|
||||
0x10576677 handle_sigsegv^M
|
||||
src/gdb/event-top.c:962^M
|
||||
0x3fffa7610477 ???^M
|
||||
0x103f2144 for_each_block^M
|
||||
src/gdb/dcache.c:199^M
|
||||
0x103f235b _Z17dcache_invalidateP13dcache_struct^M
|
||||
src/gdb/dcache.c:251^M
|
||||
0x10bde8c7 _Z24target_dcache_invalidatev^M
|
||||
src/gdb/target-dcache.c:50^M
|
||||
...
|
||||
or similar.
|
||||
|
||||
The root cause for the segmentation fault is that linux_is_uclinux gives an
|
||||
incorrect result: it should always return false, given that we're running on a
|
||||
regular linux system, but instead it returns first true, then false.
|
||||
|
||||
In more detail, the segmentation fault happens as follows:
|
||||
- a program space with an address space is created
|
||||
- a second program space is about to be created. maybe_new_address_space
|
||||
is called, and because linux_is_uclinux returns true, maybe_new_address_space
|
||||
returns false, and no new address space is created
|
||||
- a second program space with the same address space is created
|
||||
- a program space is deleted. Because linux_is_uclinux now returns false,
|
||||
gdbarch_has_shared_address_space (current_inferior ()->arch ()) returns
|
||||
false, and the address space is deleted
|
||||
- when gdb uses the address space of the remaining program space, we run into
|
||||
the segfault, because the address space is deleted.
|
||||
|
||||
Hardcoding linux_is_uclinux to false makes the test-case pass.
|
||||
|
||||
We leave addressing the root cause for the following commit in this series.
|
||||
|
||||
For now, prevent the segmentation fault by making the address space a refcounted
|
||||
object.
|
||||
|
||||
This was already suggested here [1]:
|
||||
...
|
||||
A better solution might be to have the address spaces be reference counted
|
||||
...
|
||||
|
||||
Tested on top of trunk on x86_64-linux and ppc64le-linux.
|
||||
Tested on top of gdb-14-branch on ppc64-linux.
|
||||
|
||||
Co-Authored-By: Simon Marchi <simon.marchi@polymtl.ca>
|
||||
|
||||
PR gdb/30547
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30547
|
||||
|
||||
[1] https://sourceware.org/pipermail/gdb-patches/2023-October/202928.html
|
||||
---
|
||||
gdb/breakpoint.c | 29 ++++++++-------
|
||||
gdb/inferior.c | 8 ++---
|
||||
gdb/inferior.h | 2 +-
|
||||
gdb/infrun.c | 20 +++++------
|
||||
gdb/linux-nat.c | 2 +-
|
||||
gdb/process-stratum-target.c | 2 +-
|
||||
gdb/progspace.c | 22 +++++-------
|
||||
gdb/progspace.h | 64 +++++++++++++++++++++-------------
|
||||
gdb/record-btrace.c | 2 +-
|
||||
gdb/regcache.c | 2 +-
|
||||
gdb/scoped-mock-context.h | 2 +-
|
||||
gdb/target-dcache.c | 11 +++---
|
||||
gdbsupport/refcounted-object.h | 17 +++++++++
|
||||
13 files changed, 103 insertions(+), 80 deletions(-)
|
||||
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
index f8d19356828..f4acb4ea8c4 100644
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -1605,7 +1605,7 @@ one_breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
|
||||
int bptoffset = 0;
|
||||
|
||||
if (!breakpoint_address_match (target_info->placed_address_space, 0,
|
||||
- current_program_space->aspace, 0))
|
||||
+ current_program_space->aspace.get (), 0))
|
||||
{
|
||||
/* The breakpoint is inserted in a different address space. */
|
||||
return;
|
||||
@@ -2278,7 +2278,7 @@ should_be_inserted (struct bp_location *bl)
|
||||
a breakpoint. */
|
||||
if ((bl->loc_type == bp_loc_software_breakpoint
|
||||
|| bl->loc_type == bp_loc_hardware_breakpoint)
|
||||
- && stepping_past_instruction_at (bl->pspace->aspace,
|
||||
+ && stepping_past_instruction_at (bl->pspace->aspace.get (),
|
||||
bl->address)
|
||||
/* The single-step breakpoint may be inserted at the location
|
||||
we're trying to step if the instruction branches to itself.
|
||||
@@ -2713,7 +2713,7 @@ insert_bp_location (struct bp_location *bl,
|
||||
read the breakpoint instead of returning the data saved in
|
||||
the breakpoint location's shadow contents. */
|
||||
bl->target_info.reqstd_address = bl->address;
|
||||
- bl->target_info.placed_address_space = bl->pspace->aspace;
|
||||
+ bl->target_info.placed_address_space = bl->pspace->aspace.get ();
|
||||
bl->target_info.length = bl->length;
|
||||
|
||||
/* When working with target-side conditions, we must pass all the conditions
|
||||
@@ -4276,7 +4276,7 @@ bp_location_inserted_here_p (const struct bp_location *bl,
|
||||
const address_space *aspace, CORE_ADDR pc)
|
||||
{
|
||||
if (bl->inserted
|
||||
- && breakpoint_address_match (bl->pspace->aspace, bl->address,
|
||||
+ && breakpoint_address_match (bl->pspace->aspace.get (), bl->address,
|
||||
aspace, pc))
|
||||
{
|
||||
/* An unmapped overlay can't be a match. */
|
||||
@@ -4355,7 +4355,7 @@ hardware_watchpoint_inserted_in_range (const address_space *aspace,
|
||||
continue;
|
||||
|
||||
for (bp_location *loc : bpt->locations ())
|
||||
- if (loc->pspace->aspace == aspace && loc->inserted)
|
||||
+ if (loc->pspace->aspace.get () == aspace && loc->inserted)
|
||||
{
|
||||
CORE_ADDR l, h;
|
||||
|
||||
@@ -7153,10 +7153,10 @@ breakpoint_location_address_match (struct bp_location *bl,
|
||||
const address_space *aspace,
|
||||
CORE_ADDR addr)
|
||||
{
|
||||
- return (breakpoint_address_match (bl->pspace->aspace, bl->address,
|
||||
+ return (breakpoint_address_match (bl->pspace->aspace.get (), bl->address,
|
||||
aspace, addr)
|
||||
|| (bl->length
|
||||
- && breakpoint_address_match_range (bl->pspace->aspace,
|
||||
+ && breakpoint_address_match_range (bl->pspace->aspace.get (),
|
||||
bl->address, bl->length,
|
||||
aspace, addr)));
|
||||
}
|
||||
@@ -7173,7 +7173,7 @@ breakpoint_location_address_range_overlap (struct bp_location *bl,
|
||||
CORE_ADDR addr, int len)
|
||||
{
|
||||
if (gdbarch_has_global_breakpoints (target_gdbarch ())
|
||||
- || bl->pspace->aspace == aspace)
|
||||
+ || bl->pspace->aspace.get () == aspace)
|
||||
{
|
||||
int bl_len = bl->length != 0 ? bl->length : 1;
|
||||
|
||||
@@ -7230,8 +7230,10 @@ breakpoint_locations_match (const struct bp_location *loc1,
|
||||
/* We compare bp_location.length in order to cover ranged
|
||||
breakpoints. Keep this in sync with
|
||||
bp_location_is_less_than. */
|
||||
- return (breakpoint_address_match (loc1->pspace->aspace, loc1->address,
|
||||
- loc2->pspace->aspace, loc2->address)
|
||||
+ return (breakpoint_address_match (loc1->pspace->aspace.get (),
|
||||
+ loc1->address,
|
||||
+ loc2->pspace->aspace.get (),
|
||||
+ loc2->address)
|
||||
&& (loc1->loc_type == loc2->loc_type || sw_hw_bps_match)
|
||||
&& loc1->length == loc2->length);
|
||||
}
|
||||
@@ -9297,8 +9299,9 @@ ranged_breakpoint::breakpoint_hit (const struct bp_location *bl,
|
||||
|| ws.sig () != GDB_SIGNAL_TRAP)
|
||||
return 0;
|
||||
|
||||
- return breakpoint_address_match_range (bl->pspace->aspace, bl->address,
|
||||
- bl->length, aspace, bp_addr);
|
||||
+ return breakpoint_address_match_range (bl->pspace->aspace.get (),
|
||||
+ bl->address, bl->length, aspace,
|
||||
+ bp_addr);
|
||||
}
|
||||
|
||||
/* Implement the "resources_needed" method for ranged breakpoints. */
|
||||
@@ -11696,7 +11699,7 @@ code_breakpoint::breakpoint_hit (const struct bp_location *bl,
|
||||
|| ws.sig () != GDB_SIGNAL_TRAP)
|
||||
return 0;
|
||||
|
||||
- if (!breakpoint_address_match (bl->pspace->aspace, bl->address,
|
||||
+ if (!breakpoint_address_match (bl->pspace->aspace.get (), bl->address,
|
||||
aspace, bp_addr))
|
||||
return 0;
|
||||
|
||||
diff --git a/gdb/inferior.c b/gdb/inferior.c
|
||||
index b0ecca8b63a..87c61eeafd7 100644
|
||||
--- a/gdb/inferior.c
|
||||
+++ b/gdb/inferior.c
|
||||
@@ -775,15 +775,13 @@ remove_inferior_command (const char *args, int from_tty)
|
||||
struct inferior *
|
||||
add_inferior_with_spaces (void)
|
||||
{
|
||||
- struct address_space *aspace;
|
||||
struct program_space *pspace;
|
||||
struct inferior *inf;
|
||||
|
||||
/* If all inferiors share an address space on this system, this
|
||||
doesn't really return a new address space; otherwise, it
|
||||
really does. */
|
||||
- aspace = maybe_new_address_space ();
|
||||
- pspace = new program_space (aspace);
|
||||
+ pspace = new program_space (maybe_new_address_space ());
|
||||
inf = add_inferior (0);
|
||||
inf->pspace = pspace;
|
||||
inf->aspace = pspace->aspace;
|
||||
@@ -946,15 +944,13 @@ clone_inferior_command (const char *args, int from_tty)
|
||||
|
||||
for (i = 0; i < copies; ++i)
|
||||
{
|
||||
- struct address_space *aspace;
|
||||
struct program_space *pspace;
|
||||
struct inferior *inf;
|
||||
|
||||
/* If all inferiors share an address space on this system, this
|
||||
doesn't really return a new address space; otherwise, it
|
||||
really does. */
|
||||
- aspace = maybe_new_address_space ();
|
||||
- pspace = new program_space (aspace);
|
||||
+ pspace = new program_space (maybe_new_address_space ());
|
||||
inf = add_inferior (0);
|
||||
inf->pspace = pspace;
|
||||
inf->aspace = pspace->aspace;
|
||||
diff --git a/gdb/inferior.h b/gdb/inferior.h
|
||||
index 4d001b0ad50..fa5c3c92eeb 100644
|
||||
--- a/gdb/inferior.h
|
||||
+++ b/gdb/inferior.h
|
||||
@@ -541,7 +541,7 @@ class inferior : public refcounted_object,
|
||||
bool removable = false;
|
||||
|
||||
/* The address space bound to this inferior. */
|
||||
- struct address_space *aspace = NULL;
|
||||
+ address_space_ref_ptr aspace;
|
||||
|
||||
/* The program space bound to this inferior. */
|
||||
struct program_space *pspace = NULL;
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
index c078098a6f8..4073150d80c 100644
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -501,8 +501,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \
|
||||
}
|
||||
else
|
||||
{
|
||||
- child_inf->aspace = new address_space ();
|
||||
- child_inf->pspace = new program_space (child_inf->aspace);
|
||||
+ child_inf->pspace = new program_space (new_address_space ());
|
||||
+ child_inf->aspace = child_inf->pspace->aspace;
|
||||
child_inf->removable = true;
|
||||
clone_program_space (child_inf->pspace, parent_inf->pspace);
|
||||
}
|
||||
@@ -573,8 +573,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \
|
||||
|
||||
child_inf->aspace = parent_inf->aspace;
|
||||
child_inf->pspace = parent_inf->pspace;
|
||||
- parent_inf->aspace = new address_space ();
|
||||
- parent_inf->pspace = new program_space (parent_inf->aspace);
|
||||
+ parent_inf->pspace = new program_space (new_address_space ());
|
||||
+ parent_inf->aspace = parent_inf->pspace->aspace;
|
||||
clone_program_space (parent_inf->pspace, child_inf->pspace);
|
||||
|
||||
/* The parent inferior is still the current one, so keep things
|
||||
@@ -583,8 +583,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \
|
||||
}
|
||||
else
|
||||
{
|
||||
- child_inf->aspace = new address_space ();
|
||||
- child_inf->pspace = new program_space (child_inf->aspace);
|
||||
+ child_inf->pspace = new program_space (new_address_space ());
|
||||
+ child_inf->aspace = child_inf->pspace->aspace;
|
||||
child_inf->removable = true;
|
||||
child_inf->symfile_flags = SYMFILE_NO_READ;
|
||||
clone_program_space (child_inf->pspace, parent_inf->pspace);
|
||||
@@ -938,7 +938,6 @@ handle_vfork_child_exec_or_exit (int exec)
|
||||
if (vfork_parent->pending_detach)
|
||||
{
|
||||
struct program_space *pspace;
|
||||
- struct address_space *aspace;
|
||||
|
||||
/* follow-fork child, detach-on-fork on. */
|
||||
|
||||
@@ -963,9 +962,8 @@ handle_vfork_child_exec_or_exit (int exec)
|
||||
of" a hack. */
|
||||
|
||||
pspace = inf->pspace;
|
||||
- aspace = inf->aspace;
|
||||
- inf->aspace = nullptr;
|
||||
inf->pspace = nullptr;
|
||||
+ address_space_ref_ptr aspace = std::move (inf->aspace);
|
||||
|
||||
if (print_inferior_events)
|
||||
{
|
||||
@@ -1019,7 +1017,7 @@ handle_vfork_child_exec_or_exit (int exec)
|
||||
/* Temporarily switch to the vfork parent, to facilitate ptrace
|
||||
calls done during maybe_new_address_space. */
|
||||
switch_to_thread (any_live_thread_of_inferior (vfork_parent));
|
||||
- address_space *aspace = maybe_new_address_space ();
|
||||
+ address_space_ref_ptr aspace = maybe_new_address_space ();
|
||||
|
||||
/* Switch back to the vfork child inferior. Switch to no-thread
|
||||
while running clone_program_space, so that clone_program_space
|
||||
@@ -5639,7 +5637,7 @@ handle_inferior_event (struct execution_control_state *ecs)
|
||||
= get_thread_arch_aspace_regcache (parent_inf->process_target (),
|
||||
ecs->ws.child_ptid (),
|
||||
gdbarch,
|
||||
- parent_inf->aspace);
|
||||
+ parent_inf->aspace.get ());
|
||||
/* Read PC value of parent process. */
|
||||
parent_pc = regcache_read_pc (regcache);
|
||||
|
||||
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
index 2b206a4ec1e..474d3c7f945 100644
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -4316,7 +4316,7 @@ linux_nat_target::thread_address_space (ptid_t ptid)
|
||||
|
||||
inf = find_inferior_pid (this, pid);
|
||||
gdb_assert (inf != NULL);
|
||||
- return inf->aspace;
|
||||
+ return inf->aspace.get ();
|
||||
}
|
||||
|
||||
/* Return the cached value of the processor core for thread PTID. */
|
||||
diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c
|
||||
index 4722c5a0f28..e67012a8591 100644
|
||||
--- a/gdb/process-stratum-target.c
|
||||
+++ b/gdb/process-stratum-target.c
|
||||
@@ -37,7 +37,7 @@ process_stratum_target::thread_address_space (ptid_t ptid)
|
||||
"address space of thread %s\n"),
|
||||
target_pid_to_str (ptid).c_str ());
|
||||
|
||||
- return inf->aspace;
|
||||
+ return inf->aspace.get ();
|
||||
}
|
||||
|
||||
struct gdbarch *
|
||||
diff --git a/gdb/progspace.c b/gdb/progspace.c
|
||||
index 32bdfebcf7c..55df3b65dfe 100644
|
||||
--- a/gdb/progspace.c
|
||||
+++ b/gdb/progspace.c
|
||||
@@ -54,8 +54,8 @@ address_space::address_space ()
|
||||
return a pointer to an existing address space, in case inferiors
|
||||
share an address space on this target system. */
|
||||
|
||||
-struct address_space *
|
||||
-maybe_new_address_space (void)
|
||||
+address_space_ref_ptr
|
||||
+maybe_new_address_space ()
|
||||
{
|
||||
int shared_aspace = gdbarch_has_shared_address_space (target_gdbarch ());
|
||||
|
||||
@@ -65,7 +65,7 @@ maybe_new_address_space (void)
|
||||
return program_spaces[0]->aspace;
|
||||
}
|
||||
|
||||
- return new address_space ();
|
||||
+ return new_address_space ();
|
||||
}
|
||||
|
||||
/* Start counting over from scratch. */
|
||||
@@ -93,9 +93,9 @@ remove_program_space (program_space *pspace)
|
||||
|
||||
/* See progspace.h. */
|
||||
|
||||
-program_space::program_space (address_space *aspace_)
|
||||
+program_space::program_space (address_space_ref_ptr aspace_)
|
||||
: num (++last_program_space_num),
|
||||
- aspace (aspace_)
|
||||
+ aspace (std::move (aspace_))
|
||||
{
|
||||
program_spaces.push_back (this);
|
||||
}
|
||||
@@ -118,8 +118,6 @@ program_space::~program_space ()
|
||||
/* Defer breakpoint re-set because we don't want to create new
|
||||
locations for this pspace which we're tearing down. */
|
||||
clear_symtab_users (SYMFILE_DEFER_BP_RESET);
|
||||
- if (!gdbarch_has_shared_address_space (target_gdbarch ()))
|
||||
- delete this->aspace;
|
||||
}
|
||||
|
||||
/* See progspace.h. */
|
||||
@@ -389,18 +387,14 @@ update_address_spaces (void)
|
||||
|
||||
if (shared_aspace)
|
||||
{
|
||||
- struct address_space *aspace = new address_space ();
|
||||
+ address_space_ref_ptr aspace = new_address_space ();
|
||||
|
||||
- delete current_program_space->aspace;
|
||||
for (struct program_space *pspace : program_spaces)
|
||||
pspace->aspace = aspace;
|
||||
}
|
||||
else
|
||||
for (struct program_space *pspace : program_spaces)
|
||||
- {
|
||||
- delete pspace->aspace;
|
||||
- pspace->aspace = new address_space ();
|
||||
- }
|
||||
+ pspace->aspace = new_address_space ();
|
||||
|
||||
for (inferior *inf : all_inferiors ())
|
||||
if (gdbarch_has_global_solist (target_gdbarch ()))
|
||||
@@ -437,5 +431,5 @@ initialize_progspace (void)
|
||||
modules have done that. Do this before
|
||||
initialize_current_architecture, because that accesses the ebfd
|
||||
of current_program_space. */
|
||||
- current_program_space = new program_space (new address_space ());
|
||||
+ current_program_space = new program_space (new_address_space ());
|
||||
}
|
||||
diff --git a/gdb/progspace.h b/gdb/progspace.h
|
||||
index 85215f0e2f1..07cca8c675c 100644
|
||||
--- a/gdb/progspace.h
|
||||
+++ b/gdb/progspace.h
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "solist.h"
|
||||
#include "gdbsupport/next-iterator.h"
|
||||
#include "gdbsupport/safe-iterator.h"
|
||||
+#include "gdbsupport/refcounted-object.h"
|
||||
+#include "gdbsupport/gdb_ref_ptr.h"
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
@@ -42,6 +44,40 @@ struct so_list;
|
||||
|
||||
typedef std::list<std::unique_ptr<objfile>> objfile_list;
|
||||
|
||||
+/* An address space. It is used for comparing if
|
||||
+ pspaces/inferior/threads see the same address space and for
|
||||
+ associating caches to each address space. */
|
||||
+struct address_space : public refcounted_object
|
||||
+{
|
||||
+ /* Create a new address space object, and add it to the list. */
|
||||
+ address_space ();
|
||||
+ DISABLE_COPY_AND_ASSIGN (address_space);
|
||||
+
|
||||
+ /* Returns the integer address space id of this address space. */
|
||||
+ int num () const
|
||||
+ {
|
||||
+ return m_num;
|
||||
+ }
|
||||
+
|
||||
+ /* Per aspace data-pointers required by other GDB modules. */
|
||||
+ registry<address_space> registry_fields;
|
||||
+
|
||||
+private:
|
||||
+ int m_num;
|
||||
+};
|
||||
+
|
||||
+using address_space_ref_ptr
|
||||
+ = gdb::ref_ptr<address_space,
|
||||
+ refcounted_object_delete_ref_policy<address_space>>;
|
||||
+
|
||||
+/* Create a new address space. */
|
||||
+
|
||||
+static inline address_space_ref_ptr
|
||||
+new_address_space ()
|
||||
+{
|
||||
+ return address_space_ref_ptr::new_reference (new address_space);
|
||||
+}
|
||||
+
|
||||
/* An iterator that wraps an iterator over std::unique_ptr<objfile>,
|
||||
and dereferences the returned object. This is useful for iterating
|
||||
over a list of shared pointers and returning raw pointers -- which
|
||||
@@ -191,7 +227,7 @@ struct program_space
|
||||
{
|
||||
/* Constructs a new empty program space, binds it to ASPACE, and
|
||||
adds it to the program space list. */
|
||||
- explicit program_space (address_space *aspace);
|
||||
+ explicit program_space (address_space_ref_ptr aspace);
|
||||
|
||||
/* Releases a program space, and all its contents (shared libraries,
|
||||
objfiles, and any other references to the program space in other
|
||||
@@ -332,7 +368,7 @@ struct program_space
|
||||
are global, then this field is ignored (we don't currently
|
||||
support inferiors sharing a program space if the target doesn't
|
||||
make breakpoints global). */
|
||||
- struct address_space *aspace = NULL;
|
||||
+ address_space_ref_ptr aspace;
|
||||
|
||||
/* True if this program space's section offsets don't yet represent
|
||||
the final offsets of the "live" address space (that is, the
|
||||
@@ -379,28 +415,6 @@ struct program_space
|
||||
target_section_table m_target_sections;
|
||||
};
|
||||
|
||||
-/* An address space. It is used for comparing if
|
||||
- pspaces/inferior/threads see the same address space and for
|
||||
- associating caches to each address space. */
|
||||
-struct address_space
|
||||
-{
|
||||
- /* Create a new address space object, and add it to the list. */
|
||||
- address_space ();
|
||||
- DISABLE_COPY_AND_ASSIGN (address_space);
|
||||
-
|
||||
- /* Returns the integer address space id of this address space. */
|
||||
- int num () const
|
||||
- {
|
||||
- return m_num;
|
||||
- }
|
||||
-
|
||||
- /* Per aspace data-pointers required by other GDB modules. */
|
||||
- registry<address_space> registry_fields;
|
||||
-
|
||||
-private:
|
||||
- int m_num;
|
||||
-};
|
||||
-
|
||||
/* The list of all program spaces. There's always at least one. */
|
||||
extern std::vector<struct program_space *>program_spaces;
|
||||
|
||||
@@ -443,7 +457,7 @@ class scoped_restore_current_program_space
|
||||
/* Maybe create a new address space object, and add it to the list, or
|
||||
return a pointer to an existing address space, in case inferiors
|
||||
share an address space. */
|
||||
-extern struct address_space *maybe_new_address_space (void);
|
||||
+extern address_space_ref_ptr maybe_new_address_space ();
|
||||
|
||||
/* Update all program spaces matching to address spaces. The user may
|
||||
have created several program spaces, and loaded executables into
|
||||
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
|
||||
index 0daba893813..276cdcc03b8 100644
|
||||
--- a/gdb/record-btrace.c
|
||||
+++ b/gdb/record-btrace.c
|
||||
@@ -2314,7 +2314,7 @@ record_btrace_replay_at_breakpoint (struct thread_info *tp)
|
||||
if (insn == NULL)
|
||||
return 0;
|
||||
|
||||
- return record_check_stopped_by_breakpoint (tp->inf->aspace, insn->pc,
|
||||
+ return record_check_stopped_by_breakpoint (tp->inf->aspace.get (), insn->pc,
|
||||
&btinfo->stop_reason);
|
||||
}
|
||||
|
||||
diff --git a/gdb/regcache.c b/gdb/regcache.c
|
||||
index 56b6d047874..8a0b57e67b8 100644
|
||||
--- a/gdb/regcache.c
|
||||
+++ b/gdb/regcache.c
|
||||
@@ -1617,7 +1617,7 @@ get_thread_arch_aspace_regcache_and_check (process_stratum_target *target,
|
||||
the current inferior's gdbarch. Also use the current inferior's address
|
||||
space. */
|
||||
gdbarch *arch = current_inferior ()->gdbarch;
|
||||
- address_space *aspace = current_inferior ()->aspace;
|
||||
+ address_space *aspace = current_inferior ()->aspace.get ();
|
||||
regcache *regcache
|
||||
= get_thread_arch_aspace_regcache (target, ptid, arch, aspace);
|
||||
|
||||
diff --git a/gdb/scoped-mock-context.h b/gdb/scoped-mock-context.h
|
||||
index 9ad7ebf5f0c..5f25dc7ed6b 100644
|
||||
--- a/gdb/scoped-mock-context.h
|
||||
+++ b/gdb/scoped-mock-context.h
|
||||
@@ -38,7 +38,7 @@ struct scoped_mock_context
|
||||
|
||||
Target mock_target;
|
||||
ptid_t mock_ptid {1, 1};
|
||||
- program_space mock_pspace {new address_space ()};
|
||||
+ program_space mock_pspace {new_address_space ()};
|
||||
inferior mock_inferior {mock_ptid.pid ()};
|
||||
thread_info mock_thread {&mock_inferior, mock_ptid};
|
||||
|
||||
diff --git a/gdb/target-dcache.c b/gdb/target-dcache.c
|
||||
index 13c2888e7ea..b1b772ab76e 100644
|
||||
--- a/gdb/target-dcache.c
|
||||
+++ b/gdb/target-dcache.c
|
||||
@@ -33,7 +33,7 @@ int
|
||||
target_dcache_init_p (void)
|
||||
{
|
||||
DCACHE *dcache
|
||||
- = target_dcache_aspace_key.get (current_program_space->aspace);
|
||||
+ = target_dcache_aspace_key.get (current_program_space->aspace.get ());
|
||||
|
||||
return (dcache != NULL);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ void
|
||||
target_dcache_invalidate (void)
|
||||
{
|
||||
DCACHE *dcache
|
||||
- = target_dcache_aspace_key.get (current_program_space->aspace);
|
||||
+ = target_dcache_aspace_key.get (current_program_space->aspace.get ());
|
||||
|
||||
if (dcache != NULL)
|
||||
dcache_invalidate (dcache);
|
||||
@@ -56,7 +56,7 @@ target_dcache_invalidate (void)
|
||||
DCACHE *
|
||||
target_dcache_get (void)
|
||||
{
|
||||
- return target_dcache_aspace_key.get (current_program_space->aspace);
|
||||
+ return target_dcache_aspace_key.get (current_program_space->aspace.get ());
|
||||
}
|
||||
|
||||
/* Return the target dcache. If it is not initialized yet, initialize
|
||||
@@ -66,12 +66,13 @@ DCACHE *
|
||||
target_dcache_get_or_init (void)
|
||||
{
|
||||
DCACHE *dcache
|
||||
- = target_dcache_aspace_key.get (current_program_space->aspace);
|
||||
+ = target_dcache_aspace_key.get (current_program_space->aspace.get ());
|
||||
|
||||
if (dcache == NULL)
|
||||
{
|
||||
dcache = dcache_init ();
|
||||
- target_dcache_aspace_key.set (current_program_space->aspace, dcache);
|
||||
+ target_dcache_aspace_key.set (current_program_space->aspace.get (),
|
||||
+ dcache);
|
||||
}
|
||||
|
||||
return dcache;
|
||||
diff --git a/gdbsupport/refcounted-object.h b/gdbsupport/refcounted-object.h
|
||||
index d8fdb950043..294fd873df1 100644
|
||||
--- a/gdbsupport/refcounted-object.h
|
||||
+++ b/gdbsupport/refcounted-object.h
|
||||
@@ -67,4 +67,21 @@ struct refcounted_object_ref_policy
|
||||
}
|
||||
};
|
||||
|
||||
+/* A policy class to interface gdb::ref_ptr with a refcounted_object, that
|
||||
+ deletes the object once the refcount reaches 0.. */
|
||||
+
|
||||
+template<typename T>
|
||||
+struct refcounted_object_delete_ref_policy
|
||||
+{
|
||||
+ static void incref (T *obj)
|
||||
+ { obj->incref (); }
|
||||
+
|
||||
+ static void decref (T *obj)
|
||||
+ {
|
||||
+ obj->decref ();
|
||||
+ if (obj->refcount () == 0)
|
||||
+ delete obj;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
#endif /* COMMON_REFCOUNTED_OBJECT_H */
|
||||
|
||||
base-commit: c55a452eaf9390d5659d3205f762aa2cb84511e1
|
||||
--
|
||||
2.35.3
|
||||
|
168
gdb-fix-segfault-in-for_each_block-part-2.patch
Normal file
168
gdb-fix-segfault-in-for_each_block-part-2.patch
Normal file
@@ -0,0 +1,168 @@
|
||||
From 1cd845ab3d405412aabf9b959aa527dd60143826 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Thu, 2 Nov 2023 14:51:02 +0100
|
||||
Subject: [PATCH] [gdb] Fix segfault in for_each_block, part 2
|
||||
|
||||
The previous commit describes PR gdb/30547, a segfault when running test-case
|
||||
gdb.base/vfork-follow-parent.exp on powerpc64 (likewise on s390x).
|
||||
|
||||
The root cause for the segmentation fault is that linux_is_uclinux gives an
|
||||
incorrect result: it returns true instead of false.
|
||||
|
||||
So, why does linux_is_uclinux:
|
||||
...
|
||||
int
|
||||
linux_is_uclinux (void)
|
||||
{
|
||||
CORE_ADDR dummy;
|
||||
|
||||
return (target_auxv_search (AT_NULL, &dummy) > 0
|
||||
&& target_auxv_search (AT_PAGESZ, &dummy) == 0);
|
||||
...
|
||||
return true?
|
||||
|
||||
This is because ppc_linux_target_wordsize returns 4 instead of 8, causing
|
||||
ppc_linux_nat_target::auxv_parse to misinterpret the auxv vector.
|
||||
|
||||
So, why does ppc_linux_target_wordsize:
|
||||
...
|
||||
int
|
||||
ppc_linux_target_wordsize (int tid)
|
||||
{
|
||||
int wordsize = 4;
|
||||
|
||||
/* Check for 64-bit inferior process. This is the case when the host is
|
||||
64-bit, and in addition the top bit of the MSR register is set. */
|
||||
long msr;
|
||||
|
||||
errno = 0;
|
||||
msr = (long) ptrace (PTRACE_PEEKUSER, tid, PT_MSR * 8, 0);
|
||||
if (errno == 0 && ppc64_64bit_inferior_p (msr))
|
||||
wordsize = 8;
|
||||
|
||||
return wordsize;
|
||||
}
|
||||
...
|
||||
return 4?
|
||||
|
||||
Specifically, we get this result because because tid == 0, so we get
|
||||
errno == ESRCH.
|
||||
|
||||
The tid == 0 is caused by the switch_to_no_thread in
|
||||
handle_vfork_child_exec_or_exit:
|
||||
...
|
||||
/* Switch to no-thread while running clone_program_space, so
|
||||
that clone_program_space doesn't want to read the
|
||||
selected frame of a dead process. */
|
||||
scoped_restore_current_thread restore_thread;
|
||||
switch_to_no_thread ();
|
||||
|
||||
inf->pspace = new program_space (maybe_new_address_space ());
|
||||
...
|
||||
but moving the maybe_new_address_space call to before that gives us the
|
||||
same result. The tid is no longer 0, but we still get ESRCH because the
|
||||
thread has exited.
|
||||
|
||||
Fix this in handle_vfork_child_exec_or_exit by doing the
|
||||
maybe_new_address_space call in the context of the vfork parent.
|
||||
|
||||
Tested on top of trunk on x86_64-linux and ppc64le-linux.
|
||||
Tested on top of gdb-14-branch on ppc64-linux.
|
||||
|
||||
Co-Authored-By: Simon Marchi <simon.marchi@polymtl.ca>
|
||||
|
||||
PR gdb/30547
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30547
|
||||
---
|
||||
gdb/infrun.c | 16 +++++++++++-----
|
||||
gdb/nat/ppc-linux.c | 2 ++
|
||||
gdb/ppc-linux-nat.c | 2 ++
|
||||
gdb/s390-linux-nat.c | 5 ++++-
|
||||
4 files changed, 19 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
index 9c1b1f04e4d..c078098a6f8 100644
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -1014,13 +1014,19 @@ handle_vfork_child_exec_or_exit (int exec)
|
||||
go ahead and create a new one for this exiting
|
||||
inferior. */
|
||||
|
||||
- /* Switch to no-thread while running clone_program_space, so
|
||||
- that clone_program_space doesn't want to read the
|
||||
- selected frame of a dead process. */
|
||||
scoped_restore_current_thread restore_thread;
|
||||
- switch_to_no_thread ();
|
||||
|
||||
- inf->pspace = new program_space (maybe_new_address_space ());
|
||||
+ /* Temporarily switch to the vfork parent, to facilitate ptrace
|
||||
+ calls done during maybe_new_address_space. */
|
||||
+ switch_to_thread (any_live_thread_of_inferior (vfork_parent));
|
||||
+ address_space *aspace = maybe_new_address_space ();
|
||||
+
|
||||
+ /* Switch back to the vfork child inferior. Switch to no-thread
|
||||
+ while running clone_program_space, so that clone_program_space
|
||||
+ doesn't want to read the selected frame of a dead process. */
|
||||
+ switch_to_inferior_no_thread (inf);
|
||||
+
|
||||
+ inf->pspace = new program_space (aspace);
|
||||
inf->aspace = inf->pspace->aspace;
|
||||
set_current_program_space (inf->pspace);
|
||||
inf->removable = true;
|
||||
diff --git a/gdb/nat/ppc-linux.c b/gdb/nat/ppc-linux.c
|
||||
index 0957d1b58a7..74549754806 100644
|
||||
--- a/gdb/nat/ppc-linux.c
|
||||
+++ b/gdb/nat/ppc-linux.c
|
||||
@@ -78,6 +78,8 @@ ppc64_64bit_inferior_p (long msr)
|
||||
int
|
||||
ppc_linux_target_wordsize (int tid)
|
||||
{
|
||||
+ gdb_assert (tid != 0);
|
||||
+
|
||||
int wordsize = 4;
|
||||
|
||||
/* Check for 64-bit inferior process. This is the case when the host is
|
||||
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
|
||||
index d8a8fbdf706..500fb566bc1 100644
|
||||
--- a/gdb/ppc-linux-nat.c
|
||||
+++ b/gdb/ppc-linux-nat.c
|
||||
@@ -1918,6 +1918,8 @@ ppc_linux_nat_target::auxv_parse (const gdb_byte **readptr,
|
||||
const gdb_byte *endptr, CORE_ADDR *typep,
|
||||
CORE_ADDR *valp)
|
||||
{
|
||||
+ gdb_assert (inferior_ptid != null_ptid);
|
||||
+
|
||||
int tid = inferior_ptid.lwp ();
|
||||
if (tid == 0)
|
||||
tid = inferior_ptid.pid ();
|
||||
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
|
||||
index fc3917d30be..403f37d690d 100644
|
||||
--- a/gdb/s390-linux-nat.c
|
||||
+++ b/gdb/s390-linux-nat.c
|
||||
@@ -949,10 +949,12 @@ s390_target_wordsize (void)
|
||||
/* Check for 64-bit inferior process. This is the case when the host is
|
||||
64-bit, and in addition bit 32 of the PSW mask is set. */
|
||||
#ifdef __s390x__
|
||||
+ int tid = s390_inferior_tid ();
|
||||
+ gdb_assert (tid != 0);
|
||||
long pswm;
|
||||
|
||||
errno = 0;
|
||||
- pswm = (long) ptrace (PTRACE_PEEKUSER, s390_inferior_tid (), PT_PSWMASK, 0);
|
||||
+ pswm = (long) ptrace (PTRACE_PEEKUSER, tid, PT_PSWMASK, 0);
|
||||
if (errno == 0 && (pswm & 0x100000000ul) != 0)
|
||||
wordsize = 8;
|
||||
#endif
|
||||
@@ -965,6 +967,7 @@ s390_linux_nat_target::auxv_parse (const gdb_byte **readptr,
|
||||
const gdb_byte *endptr, CORE_ADDR *typep,
|
||||
CORE_ADDR *valp)
|
||||
{
|
||||
+ gdb_assert (inferior_ptid != null_ptid);
|
||||
int sizeof_auxv_field = s390_target_wordsize ();
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
||||
const gdb_byte *ptr = *readptr;
|
||||
|
||||
base-commit: 59053f06bd94be51efacfa80f9a1f738e3e1ee9c
|
||||
--
|
||||
2.35.3
|
||||
|
@@ -6,5 +6,5 @@ index b9770ea415..3149f6e1fe 100644
|
||||
-#!/usr/bin/env bash
|
||||
+#!/bin/bash
|
||||
|
||||
# Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2023 Free Software Foundation, Inc.
|
||||
|
||||
|
132
gdb-glibc-strstr-workaround.patch
Normal file
132
gdb-glibc-strstr-workaround.patch
Normal file
@@ -0,0 +1,132 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-glibc-strstr-workaround.patch
|
||||
|
||||
;; Workaround PR libc/14166 for inferior calls of strstr.
|
||||
;;=fedoratest: Compatibility with RHELs (unchecked which ones).
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
@@ -0,0 +1,119 @@
|
||||
+# Copyright (C) 2012 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/>.
|
||||
+
|
||||
+# Workaround for:
|
||||
+# invalid IFUNC DW_AT_linkage_name: memmove strstr time
|
||||
+# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
|
||||
+
|
||||
+if {[skip_shlib_tests]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "gnu-ifunc-strstr-workaround"
|
||||
+set executable ${testfile}
|
||||
+set srcfile start.c
|
||||
+set binfile [standard_output_file ${executable}]
|
||||
+
|
||||
+if [prepare_for_testing ${testfile}.exp $executable $srcfile] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set test "ptype atoi"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "type = int \\(\\)\r\n$gdb_prompt $" {
|
||||
+ untested "$test (no DWARF)"
|
||||
+ return 0
|
||||
+ }
|
||||
+ -re "type = <unknown return type> \\(\\)\r\n$gdb_prompt $" {
|
||||
+ untested "$test (no DWARF)"
|
||||
+ return 0
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set addr ""
|
||||
+set test "print strstr"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <strstr>\r\n$gdb_prompt $" {
|
||||
+ set addr $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" {
|
||||
+ set addr $expect_out(1,string)
|
||||
+ pass "$test (GDB workaround)"
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" {
|
||||
+ set addr $expect_out(1,string)
|
||||
+ pass "$test (fixed glibc)"
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__libc_strstr_ifunc>\r\n$gdb_prompt $" {
|
||||
+ set addr $expect_out(1,string)
|
||||
+ pass "$test (fixed glibc)"
|
||||
+ }
|
||||
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
||||
+ untested "$test (gnu-ifunc not in use by glibc)"
|
||||
+ return 0
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test "info sym"
|
||||
+gdb_test_multiple "info sym $addr" $test {
|
||||
+ -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
||||
+ # unexpected
|
||||
+ xfail "$test (not in libc.so.6)"
|
||||
+ return 0
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test "info addr strstr"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" {
|
||||
+ fail "$test (DWARF for strstr)"
|
||||
+ }
|
||||
+ -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" {
|
||||
+ pass "$test"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test "print strstr second time"
|
||||
+gdb_test_multiple "print strstr" $test {
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <strstr>\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__strstr>\r\n$gdb_prompt $" {
|
||||
+ pass "$test (GDB workaround)"
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr>\r\n$gdb_prompt $" {
|
||||
+ pass "$test (fixed glibc)"
|
||||
+ }
|
||||
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__libc_strstr_ifunc>\r\n$gdb_prompt $" {
|
||||
+ pass "$test (fixed glibc)"
|
||||
+ }
|
||||
+ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test {print (char *)strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
|
||||
+gdb_test {print (char *)strstr("def","e")} { = 0x[0-9a-f]+ "ef"}
|
138
gdb-go-handle-v3-go_0-mangled-prefix.patch
Normal file
138
gdb-go-handle-v3-go_0-mangled-prefix.patch
Normal file
@@ -0,0 +1,138 @@
|
||||
From 6c9e159dbd1a35aafa134fcd52982174236a8dd9 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Thu, 5 Oct 2023 23:22:11 +0200
|
||||
Subject: [PATCH 3/3] [gdb/go] Handle v3 go_0 mangled prefix
|
||||
|
||||
With gcc-10 we have:
|
||||
...
|
||||
(gdb) break package2.Foo^M
|
||||
Breakpoint 2 at 0x402563: file package2.go, line 5.^M
|
||||
(gdb) PASS: gdb.go/package.exp: setting breakpoint 1
|
||||
...
|
||||
but with gcc-11:
|
||||
...
|
||||
gdb) break package2.Foo^M
|
||||
Function "package2.Foo" not defined.^M
|
||||
Make breakpoint pending on future shared library load? (y or [n]) n^M
|
||||
(gdb) FAIL: gdb.go/package.exp: gdb_breakpoint: set breakpoint at package2.Foo
|
||||
...
|
||||
|
||||
In the gcc-10 case, though the exec contains dwarf, it's not used to set the
|
||||
breakpoint (which is an independent problem, filed as PR go/30941), instead
|
||||
the minimal symbol information is used.
|
||||
|
||||
The minimal symbol information changed between gcc-10 and gcc-11:
|
||||
...
|
||||
$ nm a.out.10 | grep Foo
|
||||
000000000040370d T go.package2.Foo
|
||||
0000000000404e50 R go.package2.Foo..f
|
||||
$ nm a.out.11 | grep Foo
|
||||
0000000000403857 T go_0package2.Foo
|
||||
0000000000405030 R go_0package2.Foo..f
|
||||
...
|
||||
|
||||
A new v3 mangling scheme was used. The mangling schemes define a separator
|
||||
character and mangling character:
|
||||
- for v2, dot is used both as separator character and mangling character, and
|
||||
- for v3, dot is used as separator character and underscore as mangling
|
||||
character.
|
||||
|
||||
For more details, see [1] and [2].
|
||||
|
||||
In v3, "_0" demangles to ".". [ See gcc commit a01dda3c23b ("compiler, libgo:
|
||||
change mangling scheme"), function Special_char_code::Special_char_code. ]
|
||||
|
||||
Handle the new go_0 prefix in unpack_mangled_go_symbol, which fixes the
|
||||
test-case.
|
||||
|
||||
Note that this doesn't fix this regression:
|
||||
...
|
||||
$ gccgo-10 package2.go -c -g0
|
||||
$ gccgo-10 package1.go package2.o -g0
|
||||
$ gdb -q -batch a.out -ex "break go.package2.Foo"
|
||||
Breakpoint 1 at 0x40370d
|
||||
$ gccgo-11 package2.go -c -g0
|
||||
$ gccgo-11 package1.go package2.o -g0
|
||||
$ gdb -q -batch a.out -ex "break go.package2.Foo"
|
||||
Function "go.package2.Foo" not defined.
|
||||
...
|
||||
|
||||
With gcc-10, we set a breakpoint on the mangled minimal symbol. That
|
||||
one has simply changed for gcc-11, so it's equivalent to using:
|
||||
...
|
||||
$ gdb -q -batch a.out -ex "break go_0package2.Foo"
|
||||
Breakpoint 1 at 0x403857
|
||||
...
|
||||
which does work.
|
||||
|
||||
Tested on x86_64-linux:
|
||||
- openSUSE Leap 15.4, using gccgo-7,
|
||||
- openSUSE Tumbleweed, using gccgo-13.
|
||||
|
||||
PR go/27238
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27238
|
||||
|
||||
[1] https://go-review.googlesource.com/c/gofrontend/+/271726
|
||||
[2] https://github.com/golang/go/issues/41862#issuecomment-707244103
|
||||
---
|
||||
gdb/go-lang.c | 30 +++++++++++++++++++++++++++---
|
||||
1 file changed, 27 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
|
||||
index f9176ace71d..8a5568f56e0 100644
|
||||
--- a/gdb/go-lang.c
|
||||
+++ b/gdb/go-lang.c
|
||||
@@ -233,16 +233,28 @@ unpack_mangled_go_symbol (const char *mangled_name,
|
||||
libgo_.*: used by gccgo's runtime
|
||||
|
||||
Thus we don't support -fgo-prefix (except as used by the runtime). */
|
||||
- if (!startswith (mangled_name, "go.")
|
||||
- && !startswith (mangled_name, "libgo_"))
|
||||
+ bool v3;
|
||||
+ if (startswith (mangled_name, "go_0"))
|
||||
+ /* V3 mangling detected, see
|
||||
+ https://go-review.googlesource.com/c/gofrontend/+/271726 . */
|
||||
+ v3 = true;
|
||||
+ else if (startswith (mangled_name, "go.")
|
||||
+ || startswith (mangled_name, "libgo_"))
|
||||
+ v3 = false;
|
||||
+ else
|
||||
return NULL;
|
||||
|
||||
/* Quick check for whether a search may be fruitful. */
|
||||
/* Ignore anything with @plt, etc. in it. */
|
||||
if (strchr (mangled_name, '@') != NULL)
|
||||
return NULL;
|
||||
+
|
||||
/* It must have at least two dots. */
|
||||
- first_dot = strchr (mangled_name, '.');
|
||||
+ if (v3)
|
||||
+ first_dot = strchr (mangled_name, '0');
|
||||
+ else
|
||||
+ first_dot = strchr (mangled_name, '.');
|
||||
+
|
||||
if (first_dot == NULL)
|
||||
return NULL;
|
||||
/* Treat "foo.bar" as unmangled. It can collide with lots of other
|
||||
@@ -263,6 +275,18 @@ unpack_mangled_go_symbol (const char *mangled_name,
|
||||
gdb::unique_xmalloc_ptr<char> result = make_unique_xstrdup (mangled_name);
|
||||
buf = result.get ();
|
||||
|
||||
+ if (v3)
|
||||
+ {
|
||||
+ /* Replace "go_0" with "\0go.". */
|
||||
+ buf[0] = '\0';
|
||||
+ buf[1] = 'g';
|
||||
+ buf[2] = 'o';
|
||||
+ buf[3] = '.';
|
||||
+
|
||||
+ /* Skip the '\0'. */
|
||||
+ buf++;
|
||||
+ }
|
||||
+
|
||||
/* Search backwards looking for "N<digit(s)>". */
|
||||
p = buf + len;
|
||||
saw_digit = method_type = NULL;
|
||||
--
|
||||
2.35.3
|
||||
|
48
gdb-gstack.man
Normal file
48
gdb-gstack.man
Normal file
@@ -0,0 +1,48 @@
|
||||
.\"
|
||||
.\" gstack manual page.
|
||||
.\" Copyright (c) 1999 Ross Thompson
|
||||
.\" Copyright (c) 2001, 2002, 2004, 2008 Red Hat, Inc.
|
||||
.\"
|
||||
.\" Original author: Ross Thompson <ross@whatsis.com>
|
||||
.\"
|
||||
.\" 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 2, 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; see the file COPYING. If not, write to
|
||||
.\" the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
.\" Boston, MA 02111-1307, USA.
|
||||
.\"
|
||||
.TH GSTACK 1 "Feb 15 2008" "Red Hat Linux" "Linux Programmer's Manual"
|
||||
|
||||
.SH NAME
|
||||
gstack \- print a stack trace of a running process
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B gstack
|
||||
pid
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
\f3gstack\f1 attaches to the active process named by the \f3pid\f1 on
|
||||
the command line, and prints out an execution stack trace. If ELF
|
||||
symbols exist in the binary (usually the case unless you have run
|
||||
strip(1)), then symbolic addresses are printed as well.
|
||||
|
||||
If the process is part of a thread group, then \f3gstack\f1 will print
|
||||
out a stack trace for each of the threads in the group.
|
||||
|
||||
.SH SEE ALSO
|
||||
nm(1), ptrace(2), gdb(1)
|
||||
|
||||
.SH AUTHORS
|
||||
Ross Thompson <ross@whatsis.com>
|
||||
|
||||
Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
|
@@ -1,69 +0,0 @@
|
||||
From cd4f4a663f82e2f8bee58f3ef000964a2dd82769 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 28 Jan 2025 20:56:17 +0100
|
||||
Subject: [PATCH] [gdb/guile] Use SCM_DEBUG_TYPING_STRICTNESS 0
|
||||
|
||||
I build gdb with libguile v2.0.9, and ran into:
|
||||
...
|
||||
In file included from /usr/include/guile/2.0/libguile.h:56,
|
||||
from ../../gdb/guile/guile-internal.h:30,
|
||||
from ../../gdb/guile/scm-arch.c:26:
|
||||
/usr/include/guile/2.0/libguile/inline.h: In function 'int scm_is_pair(SCM)':
|
||||
/usr/include/guile/2.0/libguile/tags.h:97:53: error: \
|
||||
operation on '*0' may be undefined [-Werror=sequence-point]
|
||||
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x))
|
||||
~~~~~~~~~^~~~~
|
||||
...
|
||||
|
||||
Fix this by using SCM_DEBUG_TYPING_STRICTNESS 0.
|
||||
|
||||
We were already using this for c++20 due to a Werror=volatile in SCM_UNPACK
|
||||
when using libguile v2.0.10.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
---
|
||||
gdb/guile/guile-internal.h | 23 ++++++++++++++++++-----
|
||||
1 file changed, 18 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
|
||||
index 8d83b8b808a..85e08ca905d 100644
|
||||
--- a/gdb/guile/guile-internal.h
|
||||
+++ b/gdb/guile/guile-internal.h
|
||||
@@ -30,12 +30,25 @@
|
||||
#include "objfiles.h"
|
||||
#include "top.h"
|
||||
|
||||
-#if __cplusplus >= 202002L
|
||||
-/* Work around Werror=volatile in SCM_UNPACK for
|
||||
- SCM_DEBUG_TYPING_STRICTNESS == 1. Reported upstream:
|
||||
- https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65333 . */
|
||||
+/* For libguile v2.0.9 and SCM_DEBUG_TYPING_STRICTNESS == 1, SCM_UNPACK(x) is
|
||||
+ defined as:
|
||||
+
|
||||
+ ((scm_t_bits) (0? (*(SCM*)0=(x)): x))
|
||||
+
|
||||
+ and for v2.0.10 it's defined as:
|
||||
+
|
||||
+ ((scm_t_bits) (0? (*(volatile SCM *)0=(x)): x))
|
||||
+
|
||||
+ The volatile was added to avoid a clang warning.
|
||||
+
|
||||
+ The latter form causes a Werror=volatile with C++20.
|
||||
+ This was reported upstream (
|
||||
+ https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65333 ).
|
||||
+
|
||||
+ The former form causes a Werror=sequence-point with gcc 7-14.
|
||||
+
|
||||
+ Work around these problem by using SCM_DEBUG_TYPING_STRICTNESS == 0. */
|
||||
#define SCM_DEBUG_TYPING_STRICTNESS 0
|
||||
-#endif
|
||||
#include "libguile.h"
|
||||
|
||||
struct block;
|
||||
|
||||
base-commit: e76eb034e25f53ef2c17eab700e95d07bbbdc7aa
|
||||
--
|
||||
2.43.0
|
||||
|
165
gdb-lineno-makeup-test.patch
Normal file
165
gdb-lineno-makeup-test.patch
Normal file
@@ -0,0 +1,165 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-lineno-makeup-test.patch
|
||||
|
||||
;; Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
|
||||
;;=fedoratest
|
||||
|
||||
New testcase for:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=466222
|
||||
(for the first / customer recommended fix)
|
||||
and the upstream fix:
|
||||
http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html
|
||||
[rfc] Do not make up line information
|
||||
http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2009 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/>. */
|
||||
+
|
||||
+void
|
||||
+func (void)
|
||||
+{
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.c b/gdb/testsuite/gdb.base/lineno-makeup.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/lineno-makeup.c
|
||||
@@ -0,0 +1,35 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2009 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/>. */
|
||||
+
|
||||
+/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number
|
||||
+ information (.debug_line) so we cannot use an external object file.
|
||||
+
|
||||
+ It must not be just a label as it would alias on the next function even for
|
||||
+ correct GDB. Therefore some stub data must be placed there.
|
||||
+
|
||||
+ We need to provide a real stub function body as at least s390
|
||||
+ (s390_analyze_prologue) would skip the whole body till reaching `main'. */
|
||||
+
|
||||
+extern void func (void);
|
||||
+asm ("func: .incbin \"" BINFILENAME "\"");
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ func ();
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp
|
||||
@@ -0,0 +1,78 @@
|
||||
+# Copyright 2009 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/>.
|
||||
+
|
||||
+set testfile "lineno-makeup"
|
||||
+set srcfuncfile ${testfile}-func.c
|
||||
+set srcfile ${testfile}.c
|
||||
+set objfuncfile [standard_output_file ${testfile}-func.o]
|
||||
+set binfuncfile [standard_output_file ${testfile}-func.bin]
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
|
||||
+verbose -log "objcopy=$objcopy: $output"
|
||||
+if { $objcopy != 0 } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+set binfuncfilesize [file size $binfuncfile]
|
||||
+verbose -log "file size $binfuncfile = $binfuncfilesize"
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=-DBINFILENAME=\"$binfuncfile\"]] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+set b_addr ""
|
||||
+set test "break func"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
|
||||
+ set b_addr $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" {
|
||||
+ set b_addr $expect_out(1,string)
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
+verbose -log "b_addr=<$b_addr>"
|
||||
+
|
||||
+set p_addr ""
|
||||
+set test "print func"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "\\$\[0-9\]+ = {<text variable, no debug info>} (0x\[0-9a-f\]+) <func>\r\n$gdb_prompt $" {
|
||||
+ set p_addr $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+verbose -log "p_addr=<$p_addr>"
|
||||
+
|
||||
+set test "break address belongs to func"
|
||||
+if {$b_addr == $p_addr} {
|
||||
+ pass "$test (exact match)"
|
||||
+} else {
|
||||
+ set skip [expr $b_addr - $p_addr]
|
||||
+ if {$skip > 0 && $skip < $binfuncfilesize} {
|
||||
+ pass "$test (prologue skip by $skip bytes)"
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
224
gdb-linux_perf-bundle.patch
Normal file
224
gdb-linux_perf-bundle.patch
Normal file
@@ -0,0 +1,224 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-linux_perf-bundle.patch
|
||||
|
||||
;; [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513).
|
||||
;;=fedora
|
||||
|
||||
diff --git a/gdb/gdb.c b/gdb/gdb.c
|
||||
--- a/gdb/gdb.c
|
||||
+++ b/gdb/gdb.c
|
||||
@@ -20,11 +20,19 @@
|
||||
#include "main.h"
|
||||
#include "interps.h"
|
||||
|
||||
+#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
+extern "C" void __libipt_init(void);
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct captured_main_args args;
|
||||
|
||||
+#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
+ __libipt_init();
|
||||
+#endif
|
||||
+
|
||||
memset (&args, 0, sizeof args);
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
|
||||
--- a/gdb/nat/linux-btrace.h
|
||||
+++ b/gdb/nat/linux-btrace.h
|
||||
@@ -27,6 +27,177 @@
|
||||
# include <linux/perf_event.h>
|
||||
#endif
|
||||
|
||||
+#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
+#ifndef HAVE_LINUX_PERF_EVENT_H
|
||||
+# error "PERF_ATTR_SIZE_VER5_BUNDLE && !HAVE_LINUX_PERF_EVENT_H"
|
||||
+#endif
|
||||
+#ifndef PERF_ATTR_SIZE_VER5
|
||||
+#define PERF_ATTR_SIZE_VER5
|
||||
+#define perf_event_mmap_page perf_event_mmap_page_bundle
|
||||
+// kernel-headers-3.10.0-493.el7.x86_64/usr/include/linux/perf_event.h
|
||||
+/*
|
||||
+ * Structure of the page that can be mapped via mmap
|
||||
+ */
|
||||
+struct perf_event_mmap_page {
|
||||
+ __u32 version; /* version number of this structure */
|
||||
+ __u32 compat_version; /* lowest version this is compat with */
|
||||
+
|
||||
+ /*
|
||||
+ * Bits needed to read the hw events in user-space.
|
||||
+ *
|
||||
+ * u32 seq, time_mult, time_shift, index, width;
|
||||
+ * u64 count, enabled, running;
|
||||
+ * u64 cyc, time_offset;
|
||||
+ * s64 pmc = 0;
|
||||
+ *
|
||||
+ * do {
|
||||
+ * seq = pc->lock;
|
||||
+ * barrier()
|
||||
+ *
|
||||
+ * enabled = pc->time_enabled;
|
||||
+ * running = pc->time_running;
|
||||
+ *
|
||||
+ * if (pc->cap_usr_time && enabled != running) {
|
||||
+ * cyc = rdtsc();
|
||||
+ * time_offset = pc->time_offset;
|
||||
+ * time_mult = pc->time_mult;
|
||||
+ * time_shift = pc->time_shift;
|
||||
+ * }
|
||||
+ *
|
||||
+ * index = pc->index;
|
||||
+ * count = pc->offset;
|
||||
+ * if (pc->cap_user_rdpmc && index) {
|
||||
+ * width = pc->pmc_width;
|
||||
+ * pmc = rdpmc(index - 1);
|
||||
+ * }
|
||||
+ *
|
||||
+ * barrier();
|
||||
+ * } while (pc->lock != seq);
|
||||
+ *
|
||||
+ * NOTE: for obvious reason this only works on self-monitoring
|
||||
+ * processes.
|
||||
+ */
|
||||
+ __u32 lock; /* seqlock for synchronization */
|
||||
+ __u32 index; /* hardware event identifier */
|
||||
+ __s64 offset; /* add to hardware event value */
|
||||
+ __u64 time_enabled; /* time event active */
|
||||
+ __u64 time_running; /* time event on cpu */
|
||||
+ union {
|
||||
+ __u64 capabilities;
|
||||
+ struct {
|
||||
+ __u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */
|
||||
+ cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */
|
||||
+
|
||||
+ cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */
|
||||
+ cap_user_time : 1, /* The time_* fields are used */
|
||||
+ cap_user_time_zero : 1, /* The time_zero field is used */
|
||||
+ cap_____res : 59;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ /*
|
||||
+ * If cap_user_rdpmc this field provides the bit-width of the value
|
||||
+ * read using the rdpmc() or equivalent instruction. This can be used
|
||||
+ * to sign extend the result like:
|
||||
+ *
|
||||
+ * pmc <<= 64 - width;
|
||||
+ * pmc >>= 64 - width; // signed shift right
|
||||
+ * count += pmc;
|
||||
+ */
|
||||
+ __u16 pmc_width;
|
||||
+
|
||||
+ /*
|
||||
+ * If cap_usr_time the below fields can be used to compute the time
|
||||
+ * delta since time_enabled (in ns) using rdtsc or similar.
|
||||
+ *
|
||||
+ * u64 quot, rem;
|
||||
+ * u64 delta;
|
||||
+ *
|
||||
+ * quot = (cyc >> time_shift);
|
||||
+ * rem = cyc & (((u64)1 << time_shift) - 1);
|
||||
+ * delta = time_offset + quot * time_mult +
|
||||
+ * ((rem * time_mult) >> time_shift);
|
||||
+ *
|
||||
+ * Where time_offset,time_mult,time_shift and cyc are read in the
|
||||
+ * seqcount loop described above. This delta can then be added to
|
||||
+ * enabled and possible running (if index), improving the scaling:
|
||||
+ *
|
||||
+ * enabled += delta;
|
||||
+ * if (index)
|
||||
+ * running += delta;
|
||||
+ *
|
||||
+ * quot = count / running;
|
||||
+ * rem = count % running;
|
||||
+ * count = quot * enabled + (rem * enabled) / running;
|
||||
+ */
|
||||
+ __u16 time_shift;
|
||||
+ __u32 time_mult;
|
||||
+ __u64 time_offset;
|
||||
+ /*
|
||||
+ * If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated
|
||||
+ * from sample timestamps.
|
||||
+ *
|
||||
+ * time = timestamp - time_zero;
|
||||
+ * quot = time / time_mult;
|
||||
+ * rem = time % time_mult;
|
||||
+ * cyc = (quot << time_shift) + (rem << time_shift) / time_mult;
|
||||
+ *
|
||||
+ * And vice versa:
|
||||
+ *
|
||||
+ * quot = cyc >> time_shift;
|
||||
+ * rem = cyc & (((u64)1 << time_shift) - 1);
|
||||
+ * timestamp = time_zero + quot * time_mult +
|
||||
+ * ((rem * time_mult) >> time_shift);
|
||||
+ */
|
||||
+ __u64 time_zero;
|
||||
+ __u32 size; /* Header size up to __reserved[] fields. */
|
||||
+
|
||||
+ /*
|
||||
+ * Hole for extension of the self monitor capabilities
|
||||
+ */
|
||||
+
|
||||
+ __u8 __reserved[118*8+4]; /* align to 1k. */
|
||||
+
|
||||
+ /*
|
||||
+ * Control data for the mmap() data buffer.
|
||||
+ *
|
||||
+ * User-space reading the @data_head value should issue an smp_rmb(),
|
||||
+ * after reading this value.
|
||||
+ *
|
||||
+ * When the mapping is PROT_WRITE the @data_tail value should be
|
||||
+ * written by userspace to reflect the last read data, after issueing
|
||||
+ * an smp_mb() to separate the data read from the ->data_tail store.
|
||||
+ * In this case the kernel will not over-write unread data.
|
||||
+ *
|
||||
+ * See perf_output_put_handle() for the data ordering.
|
||||
+ *
|
||||
+ * data_{offset,size} indicate the location and size of the perf record
|
||||
+ * buffer within the mmapped area.
|
||||
+ */
|
||||
+ __u64 data_head; /* head in the data section */
|
||||
+ __u64 data_tail; /* user-space written tail */
|
||||
+ __u64 data_offset; /* where the buffer starts */
|
||||
+ __u64 data_size; /* data buffer size */
|
||||
+
|
||||
+ /*
|
||||
+ * AUX area is defined by aux_{offset,size} fields that should be set
|
||||
+ * by the userspace, so that
|
||||
+ *
|
||||
+ * aux_offset >= data_offset + data_size
|
||||
+ *
|
||||
+ * prior to mmap()ing it. Size of the mmap()ed area should be aux_size.
|
||||
+ *
|
||||
+ * Ring buffer pointers aux_{head,tail} have the same semantics as
|
||||
+ * data_{head,tail} and same ordering rules apply.
|
||||
+ */
|
||||
+ __u64 aux_head;
|
||||
+ __u64 aux_tail;
|
||||
+ __u64 aux_offset;
|
||||
+ __u64 aux_size;
|
||||
+};
|
||||
+#endif // PERF_ATTR_SIZE_VER5
|
||||
+#endif // PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
+
|
||||
struct target_ops;
|
||||
|
||||
#if HAVE_LINUX_PERF_EVENT_H
|
||||
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
|
||||
--- a/gdbsupport/common.m4
|
||||
+++ b/gdbsupport/common.m4
|
||||
@@ -166,7 +166,7 @@ AC_DEFUN([GDB_AC_COMMON], [
|
||||
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <linux/perf_event.h>
|
||||
#ifndef PERF_ATTR_SIZE_VER5
|
||||
- # error
|
||||
+ // error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL
|
||||
#endif
|
||||
]])], [perf_event=yes], [perf_event=no])
|
||||
if test "$perf_event" != yes; then
|
62
gdb-opcodes-clflushopt-test.patch
Normal file
62
gdb-opcodes-clflushopt-test.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-opcodes-clflushopt-test.patch
|
||||
|
||||
;; Test clflushopt instruction decode (for RH BZ 1262471).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.S b/gdb/testsuite/gdb.arch/amd64-clflushopt.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/amd64-clflushopt.S
|
||||
@@ -0,0 +1,19 @@
|
||||
+/* 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/>.
|
||||
+
|
||||
+ This file is part of the gdb testsuite. */
|
||||
+
|
||||
+_start: .globl _start
|
||||
+ clflushopt (%edi)
|
||||
diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.exp b/gdb/testsuite/gdb.arch/amd64-clflushopt.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/amd64-clflushopt.exp
|
||||
@@ -0,0 +1,25 @@
|
||||
+# 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/>.
|
||||
+
|
||||
+if { ![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"] } then {
|
||||
+ verbose "Skipping amd64 clflushopt test."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+if [prepare_for_testing amd64-clflushopt.exp amd64-clflushopt amd64-clflushopt.S [list debug "additional_flags=-nostdlib"]] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "disas _start" "Dump of assembler code for function _start:\r\n *0x\[0-9a-f\]+ <\[+\]0>:\tclflushopt \\(%edi\\)\r\nEnd of assembler dump\\." "clflushopt"
|
@@ -1,8 +1,3 @@
|
||||
From 086a725aa02b1195f63b2df4c2a2b4516788b2c6 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Thu, 18 Apr 2024 14:27:04 +0200
|
||||
Subject: [PATCH 42/46] gdb-python-finishbreakpoint-update
|
||||
|
||||
[gdb/python] FinishBreakPoint update
|
||||
|
||||
I.
|
||||
@@ -329,18 +324,19 @@ Tested on x86_64-linux with native and target board unix/-m32, by rebuilding
|
||||
and running the test-cases:
|
||||
- gdb.python/py-finish-breakpoint.exp
|
||||
- gdb.python/py-finish-breakpoint2.exp
|
||||
|
||||
---
|
||||
gdb/breakpoint.c | 10 ++++++++++
|
||||
gdb/doc/python.texi | 6 ++++--
|
||||
gdb/python/py-finishbreakpoint.c | 20 +++++++++++++++++++
|
||||
.../gdb.python/py-finish-breakpoint2.exp | 1 +
|
||||
4 files changed, 35 insertions(+), 2 deletions(-)
|
||||
gdb/python/py-finishbreakpoint.c | 21 +++++++++++++++++++++
|
||||
gdb/testsuite/gdb.python/py-finish-breakpoint2.exp | 16 +++++++++++++---
|
||||
4 files changed, 48 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
index 5653842ce76..6e10914a316 100644
|
||||
index dbbea6b8bff..64a9a3d394f 100644
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -14693,6 +14693,10 @@ breakpoint_free_objfile (struct objfile *objfile)
|
||||
@@ -15452,6 +15452,10 @@ initialize_breakpoint_ops (void)
|
||||
|
||||
static struct cmd_list_element *enablebreaklist = NULL;
|
||||
|
||||
@@ -351,7 +347,7 @@ index 5653842ce76..6e10914a316 100644
|
||||
/* See breakpoint.h. */
|
||||
|
||||
cmd_list_element *commands_cmd_element = nullptr;
|
||||
@@ -15255,8 +15259,14 @@ This is useful for formatted output in user-defined commands."));
|
||||
@@ -16065,6 +16069,12 @@ This is useful for formatted output in user-defined commands."));
|
||||
|
||||
gdb::observers::about_to_proceed.attach (breakpoint_about_to_proceed,
|
||||
"breakpoint");
|
||||
@@ -363,14 +359,12 @@ index 5653842ce76..6e10914a316 100644
|
||||
gdb::observers::thread_exit.attach (remove_threaded_breakpoints,
|
||||
"breakpoint");
|
||||
+#endif
|
||||
gdb::observers::inferior_removed.attach (remove_inferior_breakpoints,
|
||||
"breakpoint");
|
||||
}
|
||||
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
|
||||
index 86ccc140c6d..e49cc580b1b 100644
|
||||
index f4865b3d6a6..17a67800ba2 100644
|
||||
--- a/gdb/doc/python.texi
|
||||
+++ b/gdb/doc/python.texi
|
||||
@@ -6882,7 +6882,7 @@ is not writable.
|
||||
@@ -5698,7 +5698,7 @@ attribute is @code{None}. This attribute is writable.
|
||||
@tindex gdb.FinishBreakpoint
|
||||
|
||||
A finish breakpoint is a temporary breakpoint set at the return address of
|
||||
@@ -379,7 +373,7 @@ index 86ccc140c6d..e49cc580b1b 100644
|
||||
extends @code{gdb.Breakpoint}. The underlying breakpoint will be disabled
|
||||
and deleted when the execution will run out of the breakpoint scope (i.e.@:
|
||||
@code{Breakpoint.stop} or @code{FinishBreakpoint.out_of_scope} triggered).
|
||||
@@ -6901,7 +6901,9 @@ details about this argument.
|
||||
@@ -5717,7 +5717,9 @@ details about this argument.
|
||||
In some circumstances (e.g.@: @code{longjmp}, C@t{++} exceptions, @value{GDBN}
|
||||
@code{return} command, @dots{}), a function may not properly terminate, and
|
||||
thus never hit the finish breakpoint. When @value{GDBN} notices such a
|
||||
@@ -391,25 +385,25 @@ index 86ccc140c6d..e49cc580b1b 100644
|
||||
You may want to sub-class @code{gdb.FinishBreakpoint} and override this
|
||||
method:
|
||||
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
|
||||
index c74a2473a81..957d4ebc142 100644
|
||||
index 1d8373d807e..a881103fdad 100644
|
||||
--- a/gdb/python/py-finishbreakpoint.c
|
||||
+++ b/gdb/python/py-finishbreakpoint.c
|
||||
@@ -433,6 +433,24 @@ bpfinishpy_handle_exit (struct inferior *inf)
|
||||
bpfinishpy_detect_out_scope_cb (&bp, nullptr, true);
|
||||
@@ -398,6 +398,24 @@ bpfinishpy_handle_exit (struct inferior *inf)
|
||||
bpfinishpy_detect_out_scope_cb (bp, nullptr);
|
||||
}
|
||||
|
||||
+/* Attached to `thread_exit' notifications, triggers all the necessary out of
|
||||
+ scope notifications. */
|
||||
+
|
||||
+static void
|
||||
+bpfinishpy_handle_thread_exit (struct thread_info *tp, std::optional<ULONGEST>, bool)
|
||||
+bpfinishpy_handle_thread_exit (struct thread_info *tp, int ignore)
|
||||
+{
|
||||
+ gdbpy_enter enter_py (target_thread_architecture (tp->ptid), current_language);
|
||||
+ gdbpy_enter enter_py (target_gdbarch (), current_language);
|
||||
+
|
||||
+ for (breakpoint &bp : all_breakpoints_safe ())
|
||||
+ for (breakpoint *bp : all_breakpoints_safe ())
|
||||
+ {
|
||||
+ if (tp->global_num == bp.thread)
|
||||
+ bpfinishpy_detect_out_scope_cb (&bp, nullptr, true);
|
||||
+ if (tp->global_num == bp->thread)
|
||||
+ bpfinishpy_detect_out_scope_cb (bp, nullptr);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
@@ -418,28 +412,42 @@ index c74a2473a81..957d4ebc142 100644
|
||||
+
|
||||
/* Initialize the Python finish breakpoint code. */
|
||||
|
||||
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
|
||||
@@ -452,6 +470,8 @@ gdbpy_initialize_finishbreakpoints (void)
|
||||
int
|
||||
@@ -414,6 +432,9 @@ gdbpy_initialize_finishbreakpoints (void)
|
||||
"py-finishbreakpoint");
|
||||
gdb::observers::inferior_exit.attach (bpfinishpy_handle_exit,
|
||||
"py-finishbreakpoint");
|
||||
+ gdb::observers::thread_exit.attach
|
||||
+ (bpfinishpy_handle_thread_exit, "py-finishbreakpoint");
|
||||
+ (bpfinishpy_handle_thread_exit,
|
||||
+ bpfinishpy_handle_thread_exit_observer_token, "py-finishbreakpoint");
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
|
||||
index b837bb3a108..7d99aad2fd2 100644
|
||||
index 58e086ad3b4..46c39d0d108 100644
|
||||
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
|
||||
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
|
||||
@@ -87,6 +87,7 @@ if { $need_continue } {
|
||||
gdb_test "continue" ".*Breakpoint.* throw_exception_1.*" \
|
||||
"continue to second exception"
|
||||
}
|
||||
@@ -50,10 +50,20 @@ gdb_test "continue" "Breakpoint .*throw_exception_1.*" "run to exception 1"
|
||||
gdb_test "python print (len(gdb.breakpoints()))" "3" "check BP count"
|
||||
gdb_test "python ExceptionFinishBreakpoint(gdb.newest_frame())" \
|
||||
"init ExceptionFinishBreakpoint" "set FinishBP after the exception"
|
||||
-gdb_test "continue" ".*stopped at ExceptionFinishBreakpoint.*" "check FinishBreakpoint in catch()"
|
||||
-gdb_test "python print (len(gdb.breakpoints()))" "3" "check finish BP removal"
|
||||
|
||||
-gdb_test "continue" ".*Breakpoint.* throw_exception_1.*" "continue to second exception"
|
||||
+gdb_test_multiple "continue" "continue after setting FinishBreakpoint" {
|
||||
+ -re -wrap ".*stopped at ExceptionFinishBreakpoint.*" {
|
||||
+ pass "$gdb_test_name (scenario 1, triggered)"
|
||||
+ gdb_test "python print (len(gdb.breakpoints()))" "3" \
|
||||
+ "check finish BP removal"
|
||||
+ gdb_test "continue" ".*Breakpoint.* throw_exception_1.*" \
|
||||
+ "continue to second exception"
|
||||
+ }
|
||||
+ -re -wrap ".*Breakpoint.* throw_exception_1.*" {
|
||||
+ pass "$gdb_test_name (scenario 2, not triggered)"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
gdb_test "python ExceptionFinishBreakpoint(gdb.newest_frame())" \
|
||||
"init ExceptionFinishBreakpoint" "set FinishBP after the exception again"
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
gdb_test "continue" ".*exception did not finish.*" "FinishBreakpoint with exception thrown not caught"
|
||||
|
@@ -1,246 +0,0 @@
|
||||
From 8ed241a885f7a2d2f713aecfe471f335ae1e230b Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Tue, 29 Apr 2025 16:58:24 +0200
|
||||
Subject: [PATCH] [gdb/python] Reimplement gdb.interrupt race fix
|
||||
|
||||
Once in a while, when running test-case gdb.base/bp-cmds-continue-ctrl-c.exp,
|
||||
I run into:
|
||||
...
|
||||
Breakpoint 2, foo () at bp-cmds-continue-ctrl-c.c:23^M
|
||||
23 usleep (100);^M
|
||||
^CFAIL: $exp: run: stop with control-c (unexpected) (timeout)
|
||||
FAIL: $exp: run: stop with control-c
|
||||
...
|
||||
|
||||
This is PR python/32167, observed both on x86_64-linux and powerpc64le-linux.
|
||||
|
||||
This is not a timeout due to accidental slowness, gdb actually hangs.
|
||||
|
||||
The backtrace at the hang is (on cfarm120 running AlmaLinux 9.6):
|
||||
...
|
||||
(gdb) bt
|
||||
#0 0x00007fffbca9dd94 in __lll_lock_wait () from
|
||||
/lib64/glibc-hwcaps/power10/libc.so.6
|
||||
#1 0x00007fffbcaa6ddc in pthread_mutex_lock@@GLIBC_2.17 () from
|
||||
/lib64/glibc-hwcaps/power10/libc.so.6
|
||||
#2 0x000000001067aee8 in __gthread_mutex_lock ()
|
||||
at /usr/include/c++/11/ppc64le-redhat-linux/bits/gthr-default.h:749
|
||||
#3 0x000000001067afc8 in __gthread_recursive_mutex_lock ()
|
||||
at /usr/include/c++/11/ppc64le-redhat-linux/bits/gthr-default.h:811
|
||||
#4 0x000000001067b0d4 in std::recursive_mutex::lock ()
|
||||
at /usr/include/c++/11/mutex:108
|
||||
#5 0x000000001067b380 in std::lock_guard<std::recursive_mutex>::lock_guard ()
|
||||
at /usr/include/c++/11/bits/std_mutex.h:229
|
||||
#6 0x0000000010679d3c in set_quit_flag () at gdb/extension.c:865
|
||||
#7 0x000000001066b6dc in handle_sigint () at gdb/event-top.c:1264
|
||||
#8 0x00000000109e3b3c in handler_wrapper () at gdb/posix-hdep.c:70
|
||||
#9 <signal handler called>
|
||||
#10 0x00007fffbcaa6d14 in pthread_mutex_lock@@GLIBC_2.17 () from
|
||||
/lib64/glibc-hwcaps/power10/libc.so.6
|
||||
#11 0x000000001067aee8 in __gthread_mutex_lock ()
|
||||
at /usr/include/c++/11/ppc64le-redhat-linux/bits/gthr-default.h:749
|
||||
#12 0x000000001067afc8 in __gthread_recursive_mutex_lock ()
|
||||
at /usr/include/c++/11/ppc64le-redhat-linux/bits/gthr-default.h:811
|
||||
#13 0x000000001067b0d4 in std::recursive_mutex::lock ()
|
||||
at /usr/include/c++/11/mutex:108
|
||||
#14 0x000000001067b380 in std::lock_guard<std::recursive_mutex>::lock_guard ()
|
||||
at /usr/include/c++/11/bits/std_mutex.h:229
|
||||
#15 0x00000000106799cc in set_active_ext_lang ()
|
||||
at gdb/extension.c:775
|
||||
#16 0x0000000010b287ac in gdbpy_enter::gdbpy_enter ()
|
||||
at gdb/python/python.c:232
|
||||
#17 0x0000000010a8e3f8 in bpfinishpy_handle_stop ()
|
||||
at gdb/python/py-finishbreakpoint.c:414
|
||||
...
|
||||
|
||||
What happens here is the following:
|
||||
- the gdbpy_enter constructor attempts to set the current extension language
|
||||
to python using set_active_ext_lang
|
||||
- set_active_ext_lang attempts to lock ext_lang_mutex
|
||||
- while doing so, it is interrupted by sigint_wrapper (the SIGINT handler),
|
||||
handling a SIGINT
|
||||
- sigint_wrapper calls handle_sigint, which calls set_quit_flag, which also
|
||||
tries to lock ext_lang_mutex
|
||||
- since std::recursive_mutex::lock is not async-signal-safe, things go wrong,
|
||||
resulting in a hang.
|
||||
|
||||
The hang bisects to commit 8bb8f834672 ("Fix gdb.interrupt race"), which
|
||||
introduced the lock, making PR python/32167 a regression since gdb 15.1.
|
||||
|
||||
Commit 8bb8f834672 fixes PR dap/31263, a race reported by ThreadSanitizer:
|
||||
...
|
||||
WARNING: ThreadSanitizer: data race (pid=615372)
|
||||
|
||||
Read of size 1 at 0x00000328064c by thread T19:
|
||||
#0 set_active_ext_lang(extension_language_defn const*) gdb/extension.c:755
|
||||
#1 scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_handling()
|
||||
gdb/extension.c:697
|
||||
#2 gdbpy_interrupt gdb/python/python.c:1106
|
||||
#3 cfunction_vectorcall_NOARGS <null>
|
||||
|
||||
Previous write of size 1 at 0x00000328064c by main thread:
|
||||
#0 scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_handling()
|
||||
gdb/extension.c:704
|
||||
#1 fetch_inferior_event() gdb/infrun.c:4591
|
||||
...
|
||||
|
||||
Location is global 'cooperative_sigint_handling_disabled' of size 1 at 0x00000328064c
|
||||
|
||||
...
|
||||
|
||||
SUMMARY: ThreadSanitizer: data race gdb/extension.c:755 in \
|
||||
set_active_ext_lang(extension_language_defn const*)
|
||||
...
|
||||
|
||||
The problem here is that gdb.interrupt is called from a worker thread, and its
|
||||
implementation, gdbpy_interrupt races with the main thread on some variable.
|
||||
|
||||
Reimplement the fix for PR dap/31263, by:
|
||||
- reverting the parts of commit 8bb8f834672 related to the lock, and
|
||||
- reimplementing gdbpy_interrupt using kill.
|
||||
|
||||
This way of fixing it doesn't require a lock, and consequently fixes PR
|
||||
python/32167.
|
||||
|
||||
Tested on x86_64-linux and ppc64le-linux.
|
||||
|
||||
I also verified that PR dap/31263 remains fixed by building gdb with
|
||||
ThreadSanitizer and running the testsuite on x86_64-linux.
|
||||
|
||||
I left in the requirement (introduced by commit 8bb8f834672) that DAP requires
|
||||
thread support by the C++ compiler. It possible that this is no longer
|
||||
required, but I haven't looked into it.
|
||||
|
||||
Now the RFC part.
|
||||
|
||||
There is a problem with using kill though: it's not supported when building
|
||||
gdb using mingw. Does anybody know what should be used instead? I found
|
||||
GenerateConsoleCtrlEvent [1] which looks like a candidate.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32167
|
||||
|
||||
[1] https://learn.microsoft.com/en-us/windows/console/generateconsolectrlevent
|
||||
---
|
||||
gdb/extension.c | 39 ---------------------------------------
|
||||
gdb/python/python.c | 11 +----------
|
||||
2 files changed, 1 insertion(+), 49 deletions(-)
|
||||
|
||||
diff --git a/gdb/extension.c b/gdb/extension.c
|
||||
index b78ea4f2716..4b9f973f75a 100644
|
||||
--- a/gdb/extension.c
|
||||
+++ b/gdb/extension.c
|
||||
@@ -638,21 +638,6 @@ breakpoint_ext_lang_cond_says_stop (struct breakpoint *b)
|
||||
This requires cooperation with the extension languages so the support
|
||||
is defined here. */
|
||||
|
||||
-#if CXX_STD_THREAD
|
||||
-
|
||||
-#include <mutex>
|
||||
-
|
||||
-/* DAP needs a way to interrupt the main thread, so we added
|
||||
- gdb.interrupt. However, as this can run from any thread, we need
|
||||
- locking for the current extension language. If threading is not
|
||||
- available, DAP will not start.
|
||||
-
|
||||
- This lock is held for accesses to quit_flag, active_ext_lang, and
|
||||
- cooperative_sigint_handling_disabled. */
|
||||
-static std::recursive_mutex ext_lang_mutex;
|
||||
-
|
||||
-#endif /* CXX_STD_THREAD */
|
||||
-
|
||||
/* This flag tracks quit requests when we haven't called out to an
|
||||
extension language. it also holds quit requests when we transition to
|
||||
an extension language that doesn't have cooperative SIGINT handling. */
|
||||
@@ -708,10 +693,6 @@ static bool cooperative_sigint_handling_disabled = false;
|
||||
|
||||
scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_handling ()
|
||||
{
|
||||
-#if CXX_STD_THREAD
|
||||
- std::lock_guard guard (ext_lang_mutex);
|
||||
-#endif /* CXX_STD_THREAD */
|
||||
-
|
||||
/* Force the active extension language to the GDB scripting
|
||||
language. This ensures that a previously saved SIGINT is moved
|
||||
to the quit_flag global, as well as ensures that future SIGINTs
|
||||
@@ -729,10 +710,6 @@ scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_ha
|
||||
|
||||
scoped_disable_cooperative_sigint_handling::~scoped_disable_cooperative_sigint_handling ()
|
||||
{
|
||||
-#if CXX_STD_THREAD
|
||||
- std::lock_guard guard (ext_lang_mutex);
|
||||
-#endif /* CXX_STD_THREAD */
|
||||
-
|
||||
cooperative_sigint_handling_disabled = m_prev_cooperative_sigint_handling_disabled;
|
||||
restore_active_ext_lang (m_prev_active_ext_lang_state);
|
||||
}
|
||||
@@ -771,10 +748,6 @@ scoped_disable_cooperative_sigint_handling::~scoped_disable_cooperative_sigint_h
|
||||
struct active_ext_lang_state *
|
||||
set_active_ext_lang (const struct extension_language_defn *now_active)
|
||||
{
|
||||
-#if CXX_STD_THREAD
|
||||
- std::lock_guard guard (ext_lang_mutex);
|
||||
-#endif /* CXX_STD_THREAD */
|
||||
-
|
||||
#if GDB_SELF_TEST
|
||||
if (selftests::hook_set_active_ext_lang)
|
||||
selftests::hook_set_active_ext_lang ();
|
||||
@@ -827,10 +800,6 @@ set_active_ext_lang (const struct extension_language_defn *now_active)
|
||||
void
|
||||
restore_active_ext_lang (struct active_ext_lang_state *previous)
|
||||
{
|
||||
-#if CXX_STD_THREAD
|
||||
- std::lock_guard guard (ext_lang_mutex);
|
||||
-#endif /* CXX_STD_THREAD */
|
||||
-
|
||||
if (cooperative_sigint_handling_disabled)
|
||||
{
|
||||
/* See set_active_ext_lang. */
|
||||
@@ -861,10 +830,6 @@ restore_active_ext_lang (struct active_ext_lang_state *previous)
|
||||
void
|
||||
set_quit_flag ()
|
||||
{
|
||||
-#if CXX_STD_THREAD
|
||||
- std::lock_guard guard (ext_lang_mutex);
|
||||
-#endif /* CXX_STD_THREAD */
|
||||
-
|
||||
if (active_ext_lang->ops != NULL
|
||||
&& active_ext_lang->ops->set_quit_flag != NULL)
|
||||
active_ext_lang->ops->set_quit_flag (active_ext_lang);
|
||||
@@ -886,10 +851,6 @@ set_quit_flag ()
|
||||
bool
|
||||
check_quit_flag ()
|
||||
{
|
||||
-#if CXX_STD_THREAD
|
||||
- std::lock_guard guard (ext_lang_mutex);
|
||||
-#endif /* CXX_STD_THREAD */
|
||||
-
|
||||
bool result = false;
|
||||
|
||||
for (const struct extension_language_defn *extlang : extension_languages)
|
||||
diff --git a/gdb/python/python.c b/gdb/python/python.c
|
||||
index acd80e5515c..ecd9d8d5101 100644
|
||||
--- a/gdb/python/python.c
|
||||
+++ b/gdb/python/python.c
|
||||
@@ -1166,16 +1166,7 @@ gdbpy_post_event (PyObject *self, PyObject *args)
|
||||
static PyObject *
|
||||
gdbpy_interrupt (PyObject *self, PyObject *args)
|
||||
{
|
||||
- {
|
||||
- /* Make sure the interrupt isn't delivered immediately somehow.
|
||||
- This probably is not truly needed, but at the same time it
|
||||
- seems more clear to be explicit about the intent. */
|
||||
- gdbpy_allow_threads temporarily_exit_python;
|
||||
- scoped_disable_cooperative_sigint_handling no_python_sigint;
|
||||
-
|
||||
- set_quit_flag ();
|
||||
- }
|
||||
-
|
||||
+ kill (getpid (), SIGINT);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
base-commit: e6828c8f629fd52d7b065c45d52b6bd04acd616f
|
||||
--
|
||||
2.43.0
|
||||
|
83
gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Normal file
83
gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Normal file
@@ -0,0 +1,83 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
|
||||
|
||||
;; Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ 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 <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ printf ("Hello, World.\n");
|
||||
+ abort ();
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
|
||||
@@ -0,0 +1,39 @@
|
||||
+# Copyright 2012 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/>.
|
||||
+
|
||||
+set testfile "set-solib-absolute-prefix"
|
||||
+set srcfile ${testfile}.c
|
||||
+
|
||||
+# It is necessary to verify if the binary is 32-bit, so that the system
|
||||
+# call `__kernel_vsyscall' originates from vDSO.
|
||||
+
|
||||
+if { ![is_ilp32_target] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \
|
||||
+ "continue until abort"
|
||||
+gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \
|
||||
+ ".*warning: Unable to find dynamic linker breakpoint function.*" \
|
||||
+ "set solib-absolute-prefix"
|
||||
+gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall"
|
170
gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Normal file
170
gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Normal file
@@ -0,0 +1,170 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
|
||||
;; Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
|
||||
;;=fedoratest
|
||||
|
||||
Original message by Tom Tromey:
|
||||
|
||||
<https://sourceware.org/ml/gdb-patches/2012-03/msg00955.html>
|
||||
Message-ID: <871uoc1va3.fsf@fleche.redhat.com>
|
||||
|
||||
Comment from Sergio Durigan Junior:
|
||||
|
||||
In order to correctly test this patch, I wrote a testcase based on Jan
|
||||
Kratochvil's <gdb/testsuite/gdb.base/gcore-excessive-memory.exp>. The
|
||||
testcase, which can be seen below, tests GDB in order to see if the
|
||||
amount of memory being leaked is minimal, as requested in the bugzilla.
|
||||
It is hard to define what "minimum" is, so I ran the testcase on all
|
||||
supported RHEL architectures and came up with an average.
|
||||
|
||||
commit cc0265cdda9dc7e8665e8bfcf5b4477489daf27c
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Wed Mar 28 17:38:08 2012 +0000
|
||||
|
||||
* python/py-inferior.c (infpy_read_memory): Remove cleanups and
|
||||
explicitly free 'buffer' on exit paths. Decref 'membuf_object'
|
||||
before returning.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2014 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/>. */
|
||||
+
|
||||
+static struct x
|
||||
+ {
|
||||
+ char unsigned u[4096];
|
||||
+ } x, *px = &x;
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp
|
||||
@@ -0,0 +1,68 @@
|
||||
+# Copyright 2014 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/>.
|
||||
+
|
||||
+set testfile py-gdb-rhbz1007614-memleak-infpy_read_memory
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
|
||||
+
|
||||
+proc memory_v_pages_get {} {
|
||||
+ global pid_of_gdb
|
||||
+ set fd [open "/proc/$pid_of_gdb/statm"]
|
||||
+ gets $fd line
|
||||
+ close $fd
|
||||
+ # number of pages of virtual memory
|
||||
+ scan $line "%d" drs
|
||||
+ return $drs
|
||||
+}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ untested $testfile.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
|
||||
+
|
||||
+gdb_test "source ${remote_python_file}" ""
|
||||
+
|
||||
+gdb_test "hello-world" ""
|
||||
+
|
||||
+set kbytes_before [memory_v_pages_get]
|
||||
+verbose -log "kbytes_before = $kbytes_before"
|
||||
+
|
||||
+gdb_test "hello-world" ""
|
||||
+
|
||||
+set kbytes_after [memory_v_pages_get]
|
||||
+verbose -log "kbytes_after = $kbytes_after"
|
||||
+
|
||||
+set kbytes_diff [expr $kbytes_after - $kbytes_before]
|
||||
+verbose -log "kbytes_diff = $kbytes_diff"
|
||||
+
|
||||
+# The value "1000" was calculated by running a few GDB sessions with this
|
||||
+# testcase, and seeing how much (in average) the memory consumption
|
||||
+# increased after the "hello-world" command issued above. The average
|
||||
+# was around 500 bytes, so I chose 1000 as a high estimate.
|
||||
+if { $kbytes_diff > 1000 } {
|
||||
+ fail "there is a memory leak on GDB (RHBZ 1007614)"
|
||||
+} else {
|
||||
+ pass "there is not a memory leak on GDB (RHBZ 1007614)"
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py
|
||||
@@ -0,0 +1,30 @@
|
||||
+# Copyright (C) 2014 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/>.
|
||||
+
|
||||
+class HelloWorld (gdb.Command):
|
||||
+ """Greet the whole world."""
|
||||
+
|
||||
+ def __init__ (self):
|
||||
+ super (HelloWorld, self).__init__ ("hello-world",
|
||||
+ gdb.COMMAND_OBSCURE)
|
||||
+
|
||||
+ def invoke (self, arg, from_tty):
|
||||
+ px = gdb.parse_and_eval("px")
|
||||
+ core = gdb.inferiors()[0]
|
||||
+ for i in range(256 * 1024):
|
||||
+ chunk = core.read_memory(px, 4096)
|
||||
+ print "Hello, World!"
|
||||
+
|
||||
+HelloWorld ()
|
235
gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Normal file
235
gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Normal file
@@ -0,0 +1,235 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
|
||||
;; Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
|
||||
;; Kratochvil, RH BZ 1084404).
|
||||
;;=fedoratest
|
||||
|
||||
These testcases have been created by compiling glibc-2.17-78 on
|
||||
RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file
|
||||
present at $builddir/misc/select.o.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
|
||||
@@ -0,0 +1,34 @@
|
||||
+# 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/>.
|
||||
+
|
||||
+if { ![istarget powerpc64-*linux-*] || ![is_lp64_target] } {
|
||||
+ verbose "Skipping ppc64-prologue-skip.exp"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "ppc64-prologue-skip"
|
||||
+set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
|
||||
+set ofile "${srcdir}/${subdir}/${testfile}.o"
|
||||
+
|
||||
+if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
|
||||
+ untested "failed uudecode"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_load $ofile
|
||||
+
|
||||
+gdb_test "break ___newselect_nocancel" "Breakpoint $decimal at 0xc: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on ___newselect_nocancel"
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
|
||||
@@ -0,0 +1,70 @@
|
||||
+begin 644 ppc64-skip-prologue.o.uu
|
||||
+M?T5,1@("`0`````````````!`!4````!````````````````````````````
|
||||
+M``-(``````!```````!``!0`$8%-B-`L"@``0,(`-#@``(Y$```"3.,`('P(
|
||||
+M`J;X`0`0^"'_D4@```%@````Z`$`@#@A`'!\"`.F3H``(/@A_X%]*`*F^2$`
|
||||
+MD/CA`-#XP0#(^*$`P/B!`+CX80"P2````6````#X80!PZ.$`T.C!`,CHH0#`
|
||||
+MZ($`N.AA`+`X``".1````GP``";X80!X^`$`B.AA`'!(```!8````.DA`)#H
|
||||
+M`0"(Z&$`>'TH`Z9\#_$@."$`@$SC`"!+__]@```````,($``````````O``(
|
||||
+M7U]S96QE8W0```````````````````````````!6``(````Y!`'[#@T``0$!
|
||||
+M`0````$```$N+B]S>7-D97!S+W5N:7@``'-Y<V-A;&PM=&5M<&QA=&4N4P`!
|
||||
+M``````D"```````````#T``!`BT3`@D``0$```"/``(`````"`$`````````
|
||||
+M`````````````````"XN+W-Y<V1E<',O=6YI>"]S>7-C86QL+71E;7!L871E
|
||||
+M+E,`+W)O;W0O9VQI8F,O9VQI8F,M,BXQ-RTW."YE;#<N<W)C+V=L:6)C+3(N
|
||||
+M,3<M8S<U.&$V.#8O;6ES8P!'3E4@05,@,BXR,RXU,BXP+C$`@`$!$0`0!A$!
|
||||
+M$@$#"!L()0@3!0`````````````````L``(`````"```````````````````
|
||||
+M````````V``````````````````````````0``````%Z4@`$>$$!&PP!````
|
||||
+M`#`````8`````````+P`20YP$4%^1`X`009!0@Z``4(107Y2$49_20X`!D$&
|
||||
+M1@``````+G-Y;71A8@`N<W1R=&%B`"YS:'-T<G1A8@`N<F5L82YT97AT`"YD
|
||||
+M871A`"YB<W,`+G)E;&$N;W!D`"YN;W1E+D=.52US=&%C:P`N<F5L82YD96)U
|
||||
+M9U]L:6YE`"YR96QA+F1E8G5G7VEN9F\`+F1E8G5G7V%B8G)E=@`N<F5L82YD
|
||||
+M96)U9U]A<F%N9V5S`"YR96QA+F5H7V9R86UE````````````````````````
|
||||
+M````````````````````````````````````````````````````````````
|
||||
+M`````````"`````!``````````8```````````````````!``````````-@`
|
||||
+M```````````````````$```````````````;````!```````````````````
|
||||
+M```````````*>`````````!(````$@````$`````````"``````````8````
|
||||
+M)@````$``````````P```````````````````1@`````````````````````
|
||||
+M``````````$``````````````"P````(``````````,`````````````````
|
||||
+M``$8```````````````````````````````!```````````````V`````0``
|
||||
+M```````#```````````````````!&``````````0````````````````````
|
||||
+M"```````````````,0````0`````````````````````````````"L``````
|
||||
+M````,````!(````%``````````@`````````&````#L````!````````````
|
||||
+M``````````````````$H```````````````````````````````!````````
|
||||
+M``````!0`````0`````````````````````````````!*`````````!:````
|
||||
+M`````````````````0``````````````2P````0`````````````````````
|
||||
+M````````"O``````````&````!(````(``````````@`````````&````&$`
|
||||
+M```!``````````````````````````````&"`````````),`````````````
|
||||
+M```````!``````````````!<````!``````````````````````````````+
|
||||
+M"`````````!@````$@````H`````````"``````````8````;0````$`````
|
||||
+M`````````````````````````A4`````````%`````````````````````$`
|
||||
+M`````````````(`````!``````````````````````````````(P````````
|
||||
+M`#`````````````````````0``````````````![````!```````````````
|
||||
+M```````````````+:``````````P````$@````T`````````"``````````8
|
||||
+M````E`````$``````````@```````````````````F``````````2```````
|
||||
+M``````````````@``````````````(\````$````````````````````````
|
||||
+M``````N8`````````!@````2````#P`````````(`````````!@````1````
|
||||
+M`P`````````````````````````````"J`````````">````````````````
|
||||
+M`````0```````````````0````(`````````````````````````````"$@`
|
||||
+M```````!L````!,````+``````````@`````````&`````D````#````````
|
||||
+M``````````````````````GX`````````'H````````````````````!````
|
||||
+M`````````````````````````````````````````````P```0``````````
|
||||
+M`````````````````P```P```````````````````````````P``!```````
|
||||
+M`````````````````````P``!0```````````````````````````P``"@``
|
||||
+M`````````````````````````P``#````````````````````````````P``
|
||||
+M"````````````````````````````P``#0``````````````````````````
|
||||
+M`P``#P```````````````````````````P``!P``````````````````````
|
||||
+M```!$@``!0```````````````````-@````*$@```0`````````,````````
|
||||
+M`#`````@$``````````````````````````````P$```````````````````
|
||||
+M``````````!*$`````````````````````````````!E(@``!0``````````
|
||||
+M`````````-@```!S(@``!0```````````````````-@`7U]S96QE8W0`7U]?
|
||||
+M;F5W<V5L96-T7VYO8V%N8V5L`%]?<WES8V%L;%]E<G)O<@!?7VQI8F-?96YA
|
||||
+M8FQE7V%S>6YC8V%N8V5L`%]?;&EB8U]D:7-A8FQE7V%S>6YC8V%N8V5L`%]?
|
||||
+M;&EB8U]S96QE8W0`<V5L96-T```````````````````D````#0````H`````
|
||||
+M``````````````!<````#@````H```````````````````"4````#P````H`
|
||||
+M`````````````````````````0```"8````````````````````(````````
|
||||
+M`#,```````````````````!&`````0```"8````````````````````&````
|
||||
+M!@````$````````````````````,````!P````$````````````````````0
|
||||
+M`````0```"8````````````````````8`````0```"8`````````V```````
|
||||
+M```&````!0````$````````````````````0`````0```"8`````````````
|
||||
+6```````<`````0```!H`````````````
|
||||
+`
|
||||
+end
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp b/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp
|
||||
@@ -0,0 +1,34 @@
|
||||
+# 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/>.
|
||||
+
|
||||
+if { ![istarget s390x-*linux-*] || ![is_lp64_target] } {
|
||||
+ verbose "Skipping s390x-prologue-skip.exp"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "s390x-prologue-skip"
|
||||
+set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
|
||||
+set ofile "${srcdir}/${subdir}/${testfile}.o"
|
||||
+
|
||||
+if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
|
||||
+ untested "failed uudecode"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_load $ofile
|
||||
+
|
||||
+gdb_test "break select" "Breakpoint $decimal at 0x48: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on select"
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
|
||||
@@ -0,0 +1,64 @@
|
||||
+begin 644 s390x-prologue-skip.o.uu
|
||||
+M?T5,1@("`0`````````````!`!8````!````````````````````````````
|
||||
+M``+```````!```````!``!(`#^LE\!``).O?\&@`)+D$`.^G^_]@X^#P```D
|
||||
+MP.4`````N00``NLE\+``!`J.N00`TKD$`"#`Y0````"Y!``MZ]_Q"``$I_0`
|
||||
+M"L`0`````+\/$`"G=/_7"HZG2?`!N2$`),"T``````?^````5@`"````.0$!
|
||||
+M^PX-``$!`0$````!```!+BXO<WES9&5P<R]U;FEX``!S>7-C86QL+71E;7!L
|
||||
+M871E+E,``0`````)`@```````````]```0)F$P("``$!````CP`"``````@!
|
||||
+M```````````````````````````N+B]S>7-D97!S+W5N:7@O<WES8V%L;"UT
|
||||
+M96UP;&%T92Y3`"]R;V]T+V=L:6)C+V=L:6)C+3(N,3<M-S@N96PW+G-R8R]G
|
||||
+M;&EB8RTR+C$W+6,W-3AA-C@V+VUI<V,`1TY5($%3(#(N,C,N-3(N,"XQ`(`!
|
||||
+M`1$`$`81`1(!`P@;""4($P4`````````````````+``"``````@`````````
|
||||
+M`````````````````&@`````````````````````````%``````!>E(``7@.
|
||||
+M`1L,#Z`!````````&````!P`````````1`!,CP6.!HT'2`[``@```!`````X
|
||||
+M`````````"```````"YS>6UT86(`+G-T<G1A8@`N<VAS=')T86(`+G)E;&$N
|
||||
+M=&5X=``N9&%T80`N8G-S`"YN;W1E+D=.52US=&%C:P`N<F5L82YD96)U9U]L
|
||||
+M:6YE`"YR96QA+F1E8G5G7VEN9F\`+F1E8G5G7V%B8G)E=@`N<F5L82YD96)U
|
||||
+M9U]A<F%N9V5S`"YR96QA+F5H7V9R86UE````````````````````````````
|
||||
+M````````````````````````````````````````````````````````````
|
||||
+M````````(`````$`````````!@```````````````````$``````````:```
|
||||
+M``````````````````0``````````````!L````$````````````````````
|
||||
+M``````````F``````````&`````0`````0`````````(`````````!@````F
|
||||
+M`````0`````````#````````````````````J```````````````````````
|
||||
+M````````!```````````````+`````@``````````P``````````````````
|
||||
+M`*@```````````````````````````````0``````````````#$````!````
|
||||
+M``````````````````````````"H```````````````````````````````!
|
||||
+M``````````````!&`````0``````````````````````````````J```````
|
||||
+M``!:`````````````````````0``````````````00````0`````````````
|
||||
+M````````````````">``````````&````!`````&``````````@`````````
|
||||
+M&````%<````!``````````````````````````````$"`````````),`````
|
||||
+M```````````````!``````````````!2````!```````````````````````
|
||||
+M```````)^`````````!@````$`````@`````````"``````````8````8P``
|
||||
+M``$``````````````````````````````94`````````%```````````````
|
||||
+M``````$``````````````'8````!``````````````````````````````&P
|
||||
+M`````````#`````````````````````0``````````````!Q````!```````
|
||||
+M```````````````````````*6``````````P````$`````L`````````"```
|
||||
+M```````8````B@````$``````````@```````````````````>``````````
|
||||
+M2`````````````````````@``````````````(4````$````````````````
|
||||
+M``````````````J(`````````#`````0````#0`````````(`````````!@`
|
||||
+M```1`````P`````````````````````````````"*`````````"4````````
|
||||
+M`````````````0```````````````0````(`````````````````````````
|
||||
+M````!T`````````!L````!$````*``````````@`````````&`````D````#
|
||||
+M``````````````````````````````CP`````````(X`````````````````
|
||||
+M```!`````````````````````````````````````````````````P```0``
|
||||
+M`````````````````````````P```P```````````````````````````P``
|
||||
+M!````````````````````````````P``"```````````````````````````
|
||||
+M`P``"@```````````````````````````P``!@``````````````````````
|
||||
+M`````P``"P```````````````````````````P``#0``````````````````
|
||||
+M`````````P``!0`````````````````````````!$```````````````````
|
||||
+M```````````;$``````````````````````````````V$@```0````````!(
|
||||
+M`````````"`````_$`````````````````````````````!7$@```0``````
|
||||
+M``!6`````````!````!I$`````````````````````````````!Y(@```0``
|
||||
+M``````!(`````````"````"'(@```0````````!(`````````"``7U]L:6)C
|
||||
+M7V5N86)L95]A<WEN8V-A;F-E;`!?7VQI8F-?9&ES86)L95]A<WEN8V-A;F-E
|
||||
+M;`!?7W-E;&5C=`!?7VQI8F-?;75L=&EP;&5?=&AR96%D<P!?7W-E;&5C=%]N
|
||||
+M;V-A;F-E;`!?7W-Y<V-A;&Q?97)R;W(`7U]L:6)C7W-E;&5C=`!S96QE8W0`
|
||||
+M````````````'`````H````3``````````(`````````-@````L````3````
|
||||
+M``````(`````````2@````T````3``````````(`````````8@````\````3
|
||||
+M``````````(`````````1@````$````6````````````````````!@````4`
|
||||
+M```$````````````````````#`````8````$````````````````````$```
|
||||
+M``$````6````````````````````&`````$````6`````````&@`````````
|
||||
+M!@````0````$````````````````````$`````$````6````````````````
|
||||
+L````(`````$````%````````````````````/`````$````%`````````$@`
|
||||
+`
|
||||
+end
|
123
gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Normal file
123
gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Normal file
@@ -0,0 +1,123 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
|
||||
;; Fix '`catch syscall' doesn't work for parent after `fork' is called'
|
||||
;; (Philippe Waroquiers, RH BZ 1149205).
|
||||
;;=fedoratest
|
||||
|
||||
URL: <https://sourceware.org/ml/gdb-patches/2013-05/msg00364.html>
|
||||
Message-ID: <1368136582.30058.7.camel@soleil>
|
||||
|
||||
From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
|
||||
To: gdb-patches at sourceware dot org
|
||||
Subject: RFA: fix gdb_assert caused by 'catch signal ...' and fork
|
||||
Date: Thu, 09 May 2013 23:56:22 +0200
|
||||
|
||||
The attached patch fixes a gdb_assert caused by the combination of catch
|
||||
signal and fork:
|
||||
break-catch-sig.c:152: internal-error: signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter] > 0' failed.
|
||||
|
||||
The problem is that the signal_catch_counts is decremented by detach_breakpoints.
|
||||
The fix consists in not detaching breakpoint locations of type bp_loc_other.
|
||||
The patch introduces a new test.
|
||||
|
||||
Comments by Sergio Durigan Junior:
|
||||
|
||||
I addded a specific testcase for this patch, which tests exactly the
|
||||
issue that the customer is facing. This patch does not solve the
|
||||
whole problem of catching a syscall and forking (for more details,
|
||||
see <https://sourceware.org/bugzilla/show_bug.cgi?id=13457>,
|
||||
specifically comment #3), but it solves the issue reported by the
|
||||
customer.
|
||||
|
||||
I also removed the original testcase of this patch, because it
|
||||
relied on "catch signal", which is a command that is not implemented
|
||||
in this version of GDB.
|
||||
|
||||
commit bd9673a4ded96ea5c108601501c8e59003ea1be6
|
||||
Author: Philippe Waroquiers <philippe@sourceware.org>
|
||||
Date: Tue May 21 18:47:05 2013 +0000
|
||||
|
||||
Fix internal error caused by interaction between catch signal and fork
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
||||
@@ -0,0 +1,11 @@
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ if (fork () == 0)
|
||||
+ sleep (1);
|
||||
+ chdir (".");
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
||||
@@ -0,0 +1,58 @@
|
||||
+# 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/>.
|
||||
+
|
||||
+if { [is_remote target] || ![isnative] } then {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set testfile "gdb-rhbz1149205-catch-syscall-fork"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+# Until "catch syscall" is implemented on other targets...
|
||||
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+# This shall be updated whenever 'catch syscall' is implemented
|
||||
+# on some architecture.
|
||||
+#if { ![istarget "i\[34567\]86-*-linux*"]
|
||||
+if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"]
|
||||
+ && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"]
|
||||
+ && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] } {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load $binfile
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "catch syscall chdir" \
|
||||
+ "Catchpoint $decimal \\\(syscall (.)?chdir(.)? \\\[$decimal\\\]\\\)" \
|
||||
+ "catch syscall chdir"
|
||||
+
|
||||
+gdb_test "continue" \
|
||||
+ "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \
|
||||
+ "continue from catch syscall after fork"
|
@@ -0,0 +1,135 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
|
||||
|
||||
;; Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug
|
||||
;; description: 'C++ (and objc): Internal error on unqualified name
|
||||
;; re-set', PR 11657] (RH BZ 1186476).
|
||||
;;=fedoratest
|
||||
|
||||
Comments from Sergio Durigan Junior:
|
||||
|
||||
The "proper" fix for this whole problem would be to backport the
|
||||
"ambiguous linespec" patch series. However, it is really not
|
||||
recommended to do that for RHEL GDB, because the patch series is too
|
||||
big and could introduce unwanted regressions. Instead, what we
|
||||
chose to do was to replace the gdb_assert call by a warning (which
|
||||
allows the user to continue the debugging session), and tell the
|
||||
user that, although more than one location was found for his/her
|
||||
breakpoint, only one will be used.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* 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/>. */
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* 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/>. */
|
||||
+
|
||||
+class C
|
||||
+ {
|
||||
+ public:
|
||||
+ C () {}
|
||||
+ C (int x) {}
|
||||
+ };
|
||||
+
|
||||
+C a;
|
||||
+C b (1);
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp
|
||||
@@ -0,0 +1,51 @@
|
||||
+# 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/>.
|
||||
+
|
||||
+if { [skip_cplus_tests] } { continue }
|
||||
+if { [skip_shlib_tests] } { continue }
|
||||
+if { [is_remote target] } { continue }
|
||||
+if { [target_info exists use_gdb_stub] } { continue }
|
||||
+
|
||||
+set testfile gdb-rhbz1186476-internal-error-unqualified-name-re-set-main
|
||||
+set srcfile $testfile.cc
|
||||
+set executable $testfile
|
||||
+set binfile [standard_output_file $executable]
|
||||
+
|
||||
+set libtestfile gdb-rhbz1186476-internal-error-unqualified-name-re-set
|
||||
+set libsrcfile $libtestfile.cc
|
||||
+set sofile [standard_output_file lib$libtestfile.so]
|
||||
+
|
||||
+# Create and source the file that provides information about the compiler
|
||||
+# used to compile the test case.
|
||||
+if [get_compiler_info "c++"] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile_shlib $srcdir/$subdir/$libsrcfile $sofile {debug c++ "additional_flags=-fPIC"}] != ""
|
||||
+ || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list additional_flags=-Wl,-rpath,[file dirname ${sofile}] "c++" shlib=${sofile} ]] != ""} {
|
||||
+ untested $libtestfile.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+gdb_test_no_output "set breakpoint pending on"
|
||||
+# gdb_breakpoint would print a failure because of some warning messages
|
||||
+gdb_test "break C::C" "Breakpoint $decimal \\(C::C\\) pending."
|
||||
+
|
||||
+#gdb_test "run" "warning: Found more than one location for breakpoint #$decimal; only the first location will be used.(\r\n)+Breakpoint $decimal, C::C.*"
|
||||
+gdb_test "run"
|
||||
+
|
||||
+gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*"
|
104
gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Normal file
104
gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Normal file
@@ -0,0 +1,104 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
|
||||
|
||||
;; [aarch64] Fix hardware watchpoints (RH BZ 1261564).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
|
||||
@@ -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;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
|
||||
@@ -0,0 +1,53 @@
|
||||
+# 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 }
|
||||
+
|
||||
+set test "rwatch aligned.var4"
|
||||
+if [istarget "s390*-*-*"] {
|
||||
+ gdb_test $test {Target does not support this type of hardware watchpoint\.}
|
||||
+ untested "s390* does not support hw read watchpoint"
|
||||
+ return
|
||||
+}
|
||||
+gdb_test $test "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 }
|
||||
+
|
||||
+# Assumes: PPC_PTRACE_GETHWDBGINFO::data_bp_alignment == 8
|
||||
+# 'lwz' does read only 4 bytes but the hw watchpoint is 8 bytes wide.
|
||||
+setup_xfail "powerpc*-*-*"
|
||||
+
|
||||
+gdb_continue_to_end
|
83
gdb-rhbz1350436-type-printers-error.patch
Normal file
83
gdb-rhbz1350436-type-printers-error.patch
Normal file
@@ -0,0 +1,83 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-rhbz1350436-type-printers-error.patch
|
||||
|
||||
;; Test 'info type-printers' Python error (RH BZ 1350436).
|
||||
;;=fedoratest
|
||||
|
||||
Typo in Python support breaks info type-printers command
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1350436
|
||||
|
||||
[testsuite patch] PR python/17136: 'info type-printers' causes an exception when there are per-objfile printers
|
||||
https://sourceware.org/ml/gdb-patches/2016-06/msg00455.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc
|
||||
--- a/gdb/testsuite/gdb.python/py-typeprint.cc
|
||||
+++ b/gdb/testsuite/gdb.python/py-typeprint.cc
|
||||
@@ -31,6 +31,12 @@ templ<basic_string> s;
|
||||
|
||||
basic_string bs;
|
||||
|
||||
+class Other
|
||||
+{
|
||||
+};
|
||||
+
|
||||
+Other ovar;
|
||||
+
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.python/py-typeprint.exp
|
||||
--- a/gdb/testsuite/gdb.python/py-typeprint.exp
|
||||
+++ b/gdb/testsuite/gdb.python/py-typeprint.exp
|
||||
@@ -50,3 +50,7 @@ gdb_test_no_output "enable type-printer string"
|
||||
gdb_test "whatis bs" "string" "whatis with enabled printer"
|
||||
|
||||
gdb_test "whatis s" "templ<string>"
|
||||
+
|
||||
+gdb_test "info type-printers" "Type printers for \[^\r\n\]*/py-typeprint:\r\n *other\r\n.*" \
|
||||
+ "info type-printers for other"
|
||||
+gdb_test "whatis ovar" "type = Another"
|
||||
diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py
|
||||
--- a/gdb/testsuite/gdb.python/py-typeprint.py
|
||||
+++ b/gdb/testsuite/gdb.python/py-typeprint.py
|
||||
@@ -15,8 +15,7 @@
|
||||
|
||||
import gdb
|
||||
|
||||
-
|
||||
-class Recognizer(object):
|
||||
+class StringRecognizer(object):
|
||||
def __init__(self):
|
||||
self.enabled = True
|
||||
|
||||
@@ -32,7 +31,27 @@ class StringTypePrinter(object):
|
||||
self.enabled = True
|
||||
|
||||
def instantiate(self):
|
||||
- return Recognizer()
|
||||
+ return StringRecognizer()
|
||||
|
||||
|
||||
gdb.type_printers.append(StringTypePrinter())
|
||||
+
|
||||
+class OtherRecognizer(object):
|
||||
+ def __init__(self):
|
||||
+ self.enabled = True
|
||||
+
|
||||
+ def recognize(self, type_obj):
|
||||
+ if type_obj.tag == 'Other':
|
||||
+ return 'Another'
|
||||
+ return None
|
||||
+
|
||||
+class OtherTypePrinter(object):
|
||||
+ def __init__(self):
|
||||
+ self.name = 'other'
|
||||
+ self.enabled = True
|
||||
+
|
||||
+ def instantiate(self):
|
||||
+ return OtherRecognizer()
|
||||
+
|
||||
+import gdb.types
|
||||
+gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter())
|
81
gdb-rhbz1553104-s390x-arch12-test.patch
Normal file
81
gdb-rhbz1553104-s390x-arch12-test.patch
Normal file
@@ -0,0 +1,81 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 23 Mar 2018 20:42:44 +0100
|
||||
Subject: gdb-rhbz1553104-s390x-arch12-test.patch
|
||||
|
||||
;; [s390x] Backport arch12 instructions decoding (RH BZ 1553104).
|
||||
;; =fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.S b/gdb/testsuite/gdb.arch/s390x-arch12.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.S
|
||||
@@ -0,0 +1,4 @@
|
||||
+.text
|
||||
+.globl load_guarded
|
||||
+load_guarded:
|
||||
+.byte 0xeb,0xbf,0xf0,0x58,0x00,0x24,0xe3,0xf0,0xff,0x50,0xff,0x71,0xb9,0x04,0x00,0xbf,0xe3,0x20,0xb0,0xa0,0x00,0x24,0xe3,0x10,0xb0,0xa0,0x00,0x04,0xe3,0x10,0x10,0x00,0x00,0x4c,0xe3,0x10,0xb0,0xa8,0x00,0x24,0xe3,0x10,0xb0,0xa8,0x00,0x04,0xb9,0x04,0x00,0x21,0xe3,0x40,0xb1,0x20,0x00,0x04,0xeb,0xbf,0xb1,0x08,0x00,0x04,0x07,0xf4
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp
|
||||
@@ -0,0 +1,34 @@
|
||||
+# Copyright 2018 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 { ![istarget s390x-*linux-*] || ![is_lp64_target] } {
|
||||
+# verbose "Skipping s390x-prologue-skip.exp"
|
||||
+# return
|
||||
+#}
|
||||
+
|
||||
+set testfile "s390x-arch12"
|
||||
+set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
|
||||
+set ofile "${srcdir}/${subdir}/${testfile}.o"
|
||||
+
|
||||
+if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
|
||||
+ untested "failed uudecode"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_load $ofile
|
||||
+
|
||||
+gdb_test "disas load_guarded" " <\\+28>:\tlgg\t%r1,0\\(%r1\\)\r\n\[^\r\n\]* <\\+34>:\tstg\t%r1,168\\(%r11\\)\r\n.*"
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.o.uu b/gdb/testsuite/gdb.arch/s390x-arch12.o.uu
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.o.uu
|
||||
@@ -0,0 +1,20 @@
|
||||
+begin 644 s390x-arch12.o
|
||||
+M?T5,1@("`0`````````````!`!8````!````````````````````````````
|
||||
+M``$X``````!```````!```<`!.N_\%@`)./P_U#_<;D$`+_C(+"@`"3C$+"@
|
||||
+M``3C$!```$SC$+"H`"3C$+"H``2Y!``AXT"Q(``$Z[^Q"``$!_0`+G-Y;71A
|
||||
+M8@`N<W1R=&%B`"YS:'-T<G1A8@`N=&5X=``N9&%T80`N8G-S````````````
|
||||
+M`````````````````````````````````P```0``````````````````````
|
||||
+M`````P```@```````````````````````````P```P``````````````````
|
||||
+M```````!$````0``````````````````````;&]A9%]G=6%R9&5D````````
|
||||
+M````````````````````````````````````````````````````````````
|
||||
+M`````````````````````````!L````!``````````8`````````````````
|
||||
+M``!``````````$`````````````````````$```````````````A`````0``
|
||||
+M```````#````````````````````@```````````````````````````````
|
||||
+M!```````````````)P````@``````````P```````````````````(``````
|
||||
+M``````````````````````````0``````````````!$````#````````````
|
||||
+M``````````````````"``````````"P````````````````````!````````
|
||||
+M```````!`````@``````````````````````````````L`````````!X````
|
||||
+M!@````0`````````"``````````8````"0````,`````````````````````
|
||||
+H`````````2@`````````#@````````````````````$`````````````
|
||||
+`
|
||||
+end
|
105
gdb-rhbz1773651-gdb-index-internal-error.patch
Normal file
105
gdb-rhbz1773651-gdb-index-internal-error.patch
Normal file
@@ -0,0 +1,105 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Mon, 2 Oct 2023 15:05:23 -0700
|
||||
Subject: gdb-rhbz1773651-gdb-index-internal-error.patch
|
||||
|
||||
;; Backport upstream patch which prevents internal error when
|
||||
;; generating a gdb-index file (RH BZ 1773651).
|
||||
|
||||
Throw error when creating an overly large gdb-index file
|
||||
|
||||
The header in a .gdb_index section uses 32-bit unsigned offsets to
|
||||
refer to other areas of the section. Thus, there is a size limit of
|
||||
2^32-1 which is currently unaccounted for by GDB's code for outputting
|
||||
these sections.
|
||||
|
||||
At the moment, when GDB creates an overly large section, it will exit
|
||||
abnormally due to an internal error, which is caused by a failed
|
||||
assert in assert_file_size, which in turn is called from
|
||||
write_gdbindex_1, both of which are in gdb/dwarf2/index-write.c.
|
||||
|
||||
This is what happens when that assert fails:
|
||||
|
||||
$ gdb -q -nx -iex 'set auto-load no' -iex 'set debuginfod enabled off' -ex file ./libgraph_tool_inference.so -ex "save gdb-index `pwd`/"
|
||||
Reading symbols from ./libgraph_tool_inference.so...
|
||||
No executable file now.
|
||||
Discard symbol table from `libgraph_tool_inference.so'? (y or n) n
|
||||
Not confirmed.
|
||||
../../gdb/dwarf2/index-write.c:1069: internal-error: assert_file_size: Assertion `file_size == expected_size' failed.
|
||||
A problem internal to GDB has been detected,
|
||||
further debugging may prove unreliable.
|
||||
----- Backtrace -----
|
||||
0x55fddb4d78b0 gdb_internal_backtrace_1
|
||||
../../gdb/bt-utils.c:122
|
||||
0x55fddb4d78b0 _Z22gdb_internal_backtracev
|
||||
../../gdb/bt-utils.c:168
|
||||
0x55fddb98b5d4 internal_vproblem
|
||||
../../gdb/utils.c:396
|
||||
0x55fddb98b8de _Z15internal_verrorPKciS0_P13__va_list_tag
|
||||
../../gdb/utils.c:476
|
||||
0x55fddbb71654 _Z18internal_error_locPKciS0_z
|
||||
../../gdbsupport/errors.cc:58
|
||||
0x55fddb5a0f23 assert_file_size
|
||||
../../gdb/dwarf2/index-write.c:1069
|
||||
0x55fddb5a1ee0 assert_file_size
|
||||
/usr/include/c++/13/bits/stl_iterator.h:1158
|
||||
0x55fddb5a1ee0 write_gdbindex_1
|
||||
../../gdb/dwarf2/index-write.c:1119
|
||||
0x55fddb5a51be write_gdbindex
|
||||
../../gdb/dwarf2/index-write.c:1273
|
||||
[...]
|
||||
---------------------
|
||||
../../gdb/dwarf2/index-write.c:1069: internal-error: assert_file_size: Assertion `file_size == expected_size' failed.
|
||||
|
||||
This problem was encountered while building the python-graph-tool
|
||||
package on Fedora. The Fedora bugzilla bug can be found here:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1773651
|
||||
|
||||
This commit prevents the internal error from occurring by calling error()
|
||||
when the file size exceeds 2^32-1.
|
||||
|
||||
Using a gdb built with this commit, I now see this behavior instead:
|
||||
|
||||
$ gdb -q -nx -iex 'set auto-load no' -iex 'set debuginfod enabled off' -ex file ./libgraph_tool_inference.so -ex "save gdb-index `pwd`/"
|
||||
Reading symbols from ./libgraph_tool_inference.so...
|
||||
No executable file now.
|
||||
Discard symbol table from `/mesquite2/fedora-bugs/1773651/libgraph_tool_inference.so'? (y or n) n
|
||||
Not confirmed.
|
||||
Error while writing index for `/mesquite2/fedora-bugs/1773651/libgraph_tool_inference.so': gdb-index maximum file size of 4294967295 exceeded
|
||||
(gdb)
|
||||
|
||||
I wish I could provide a test case, but due to the sizes of both the
|
||||
input and output files, I think that testing resources would be
|
||||
strained or exceeded in many environments.
|
||||
|
||||
My testing on Fedora 38 shows no regressions.
|
||||
|
||||
Approved-by: Tom Tromey <tom@tromey.com>
|
||||
|
||||
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
|
||||
--- a/gdb/dwarf2/index-write.c
|
||||
+++ b/gdb/dwarf2/index-write.c
|
||||
@@ -1082,7 +1082,7 @@ write_gdbindex_1 (FILE *out_file,
|
||||
{
|
||||
data_buf contents;
|
||||
const offset_type size_of_header = 6 * sizeof (offset_type);
|
||||
- offset_type total_len = size_of_header;
|
||||
+ size_t total_len = size_of_header;
|
||||
|
||||
/* The version number. */
|
||||
contents.append_offset (8);
|
||||
@@ -1109,6 +1109,13 @@ write_gdbindex_1 (FILE *out_file,
|
||||
|
||||
gdb_assert (contents.size () == size_of_header);
|
||||
|
||||
+ /* The maximum size of an index file is limited by the maximum value
|
||||
+ capable of being represented by 'offset_type'. Throw an error if
|
||||
+ that length has been exceeded. */
|
||||
+ size_t max_size = ~(offset_type) 0;
|
||||
+ if (total_len > max_size)
|
||||
+ error (_("gdb-index maximum file size of %zu exceeded"), max_size);
|
||||
+
|
||||
contents.file_write (out_file);
|
||||
cu_list.file_write (out_file);
|
||||
types_cu_list.file_write (out_file);
|
108
gdb-rhbz2160211-excessive-core-file-warnings.patch
Normal file
108
gdb-rhbz2160211-excessive-core-file-warnings.patch
Normal file
@@ -0,0 +1,108 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Thu, 29 Jun 2023 18:20:30 -0700
|
||||
Subject: gdb-rhbz2160211-excessive-core-file-warnings.patch
|
||||
|
||||
;; Backport two commits, 0ad504dd464 and ea70f941f9b, from Lancelot SIX
|
||||
;; which prevent repeated warnings from being printed while loading a
|
||||
;; core file. (RH BZ 2160211)
|
||||
|
||||
gdb/corelow.c: avoid repeated warnings in build_file_mappings
|
||||
|
||||
When GDB opens a coredump it tries to locate and then open all files
|
||||
which were mapped in the process.
|
||||
|
||||
If a file is found but cannot be opened with BFD (bfd_open /
|
||||
bfd_check_format fails), then a warning is printed to the user. If the
|
||||
same file was mapped multiple times in the process's address space, the
|
||||
warning is printed once for each time the file was mapped. I find this
|
||||
un-necessarily noisy.
|
||||
|
||||
This patch makes it so the warning message is printed only once per
|
||||
file.
|
||||
|
||||
There was a comment in the code assuming that if the file was found on
|
||||
the system, opening it (bfd_open + bfd_check_format) should always
|
||||
succeed. A recent change in BFD (014a602b86f "Don't optimise bfd_seek
|
||||
to same position") showed that this assumption is not valid. For
|
||||
example, it is possible to have a core dump of a process which had
|
||||
mmaped an IO page from a DRI render node (/dev/dri/runderD$NUM). In
|
||||
such case the core dump does contain the information that portions of
|
||||
this special file were mapped in the host process, but trying to seek to
|
||||
position 0 will fail, making bfd_check_format fail. This patch removes
|
||||
this comment.
|
||||
|
||||
Reviewed-By: John Baldwin <jhb@FreeBSD.org>
|
||||
Approved-By: Andrew Burgess <aburgess@redhat.com>
|
||||
|
||||
gdb/corelow.c: do not try to reopen a file if open failed once
|
||||
|
||||
In the current implementation, core_target::build_file_mappings will try
|
||||
to locate and open files which were mapped in the process for which the
|
||||
core dump was produced. If the file cannot be found or cannot be
|
||||
opened, GDB will re-try to open it once for each time it was mapped in
|
||||
the process's address space.
|
||||
|
||||
This patch makes it so GDB recognizes that it has already failed to open
|
||||
a given file once and does not re-try the process for each mapping.
|
||||
|
||||
Reviewed-By: John Baldwin <jhb@FreeBSD.org>
|
||||
Approved-By: Andrew Burgess <aburgess@redhat.com>
|
||||
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -237,6 +237,16 @@ core_target::build_file_mappings ()
|
||||
weed out non-file-backed mappings. */
|
||||
gdb_assert (filename != nullptr);
|
||||
|
||||
+ if (unavailable_paths.find (filename) != unavailable_paths.end ())
|
||||
+ {
|
||||
+ /* We have already seen some mapping for FILENAME but failed to
|
||||
+ find/open the file. There is no point in trying the same
|
||||
+ thing again so just record that the range [start, end) is
|
||||
+ unavailable. */
|
||||
+ m_core_unavailable_mappings.emplace_back (start, end - start);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
struct bfd *bfd = bfd_map[filename];
|
||||
if (bfd == nullptr)
|
||||
{
|
||||
@@ -254,11 +264,10 @@ core_target::build_file_mappings ()
|
||||
if (expanded_fname == nullptr)
|
||||
{
|
||||
m_core_unavailable_mappings.emplace_back (start, end - start);
|
||||
- /* Print just one warning per path. */
|
||||
- if (unavailable_paths.insert (filename).second)
|
||||
- warning (_("Can't open file %s during file-backed mapping "
|
||||
- "note processing"),
|
||||
- filename);
|
||||
+ unavailable_paths.insert (filename);
|
||||
+ warning (_("Can't open file %s during file-backed mapping "
|
||||
+ "note processing"),
|
||||
+ filename);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,18 +277,11 @@ core_target::build_file_mappings ()
|
||||
if (bfd == nullptr || !bfd_check_format (bfd, bfd_object))
|
||||
{
|
||||
m_core_unavailable_mappings.emplace_back (start, end - start);
|
||||
- /* If we get here, there's a good chance that it's due to
|
||||
- an internal error. We issue a warning instead of an
|
||||
- internal error because of the possibility that the
|
||||
- file was removed in between checking for its
|
||||
- existence during the expansion in exec_file_find()
|
||||
- and the calls to bfd_openr() / bfd_check_format().
|
||||
- Output both the path from the core file note along
|
||||
- with its expansion to make debugging this problem
|
||||
- easier. */
|
||||
+ unavailable_paths.insert (filename);
|
||||
warning (_("Can't open file %s which was expanded to %s "
|
||||
"during file-backed mapping note processing"),
|
||||
filename, expanded_fname.get ());
|
||||
+
|
||||
if (bfd != nullptr)
|
||||
bfd_close (bfd);
|
||||
return;
|
107
gdb-rhbz2192105-ftbs-dangling-pointer
Normal file
107
gdb-rhbz2192105-ftbs-dangling-pointer
Normal file
@@ -0,0 +1,107 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Buettner <kevinb@redhat.com>
|
||||
Date: Wed, 3 May 2023 11:28:24 -0700
|
||||
Subject: gdb-rhbz2192105-ftbs-dangling-pointer
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
;; Backport upstream patch fixing a "dangling pointer" build problem
|
||||
;; first seen when building with GCC 13.1.1 20230426 (Red Hat ;; 13.1.1-1).
|
||||
|
||||
Pass const frame_info_ptr reference for skip_[language_]trampoline
|
||||
|
||||
g++ 13.1.1 produces a -Werror=dangling-pointer=
|
||||
|
||||
In file included from ../../binutils-gdb/gdb/frame.h:75,
|
||||
from ../../binutils-gdb/gdb/symtab.h:40,
|
||||
from ../../binutils-gdb/gdb/language.c:33:
|
||||
In member function ‘void intrusive_list<T, AsNode>::push_empty(T&) [with T = frame_info_ptr; AsNode = intrusive_base_node<frame_info_ptr>]’,
|
||||
inlined from ‘void intrusive_list<T, AsNode>::push_back(reference) [with T = frame_info_ptr; AsNode = intrusive_base_node<frame_info_ptr>]’ at gdbsupport/intrusive_list.h:332:24,
|
||||
inlined from ‘frame_info_ptr::frame_info_ptr(const frame_info_ptr&)’ at gdb/frame.h:241:26,
|
||||
inlined from ‘CORE_ADDR skip_language_trampoline(frame_info_ptr, CORE_ADDR)’ at gdb/language.c:530:49:
|
||||
gdbsupport/intrusive_list.h:415:12: error: storing the address of local variable ‘<anonymous>’ in ‘frame_info_ptr::frame_list.intrusive_list<frame_info_ptr>::m_back’ [-Werror=dangling-pointer=]
|
||||
415 | m_back = &elem;
|
||||
| ~~~~~~~^~~~~~~
|
||||
gdb/language.c: In function ‘CORE_ADDR skip_language_trampoline(frame_info_ptr, CORE_ADDR)’:
|
||||
gdb/language.c:530:49: note: ‘<anonymous>’ declared here
|
||||
530 | CORE_ADDR real_pc = lang->skip_trampoline (frame, pc);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
|
||||
gdb/frame.h:359:41: note: ‘frame_info_ptr::frame_list’ declared here
|
||||
359 | static intrusive_list<frame_info_ptr> frame_list;
|
||||
| ^~~~~~~~~~
|
||||
|
||||
Each new frame_info_ptr is being pushed on a static frame list and g++
|
||||
cannot see why that is safe in case the frame_info_ptr is created and
|
||||
destroyed immediately when passed as value.
|
||||
|
||||
It isn't clear why only in this one place g++ sees the issue (probably
|
||||
because it can inline enough code in this specific case).
|
||||
|
||||
Since passing the frame_info_ptr as const reference is cheaper, use
|
||||
that as workaround for this warning.
|
||||
|
||||
PR build/30413
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30413
|
||||
|
||||
Tested-by: Kevin Buettner <kevinb@redhat.com>
|
||||
Reviewed-by: Kevin Buettner <kevinb@redhat.com>
|
||||
Reviewed-by: Tom Tromey <tom@tromey.com>
|
||||
|
||||
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
|
||||
--- a/gdb/c-lang.c
|
||||
+++ b/gdb/c-lang.c
|
||||
@@ -1003,7 +1003,7 @@ class cplus_language : public language_defn
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
- CORE_ADDR skip_trampoline (frame_info_ptr fi,
|
||||
+ CORE_ADDR skip_trampoline (const frame_info_ptr &fi,
|
||||
CORE_ADDR pc) const override
|
||||
{
|
||||
return cplus_skip_trampoline (fi, pc);
|
||||
diff --git a/gdb/language.c b/gdb/language.c
|
||||
--- a/gdb/language.c
|
||||
+++ b/gdb/language.c
|
||||
@@ -528,7 +528,7 @@ add_set_language_command ()
|
||||
Return the result from the first that returns non-zero, or 0 if all
|
||||
`fail'. */
|
||||
CORE_ADDR
|
||||
-skip_language_trampoline (frame_info_ptr frame, CORE_ADDR pc)
|
||||
+skip_language_trampoline (const frame_info_ptr &frame, CORE_ADDR pc)
|
||||
{
|
||||
for (const auto &lang : language_defn::languages)
|
||||
{
|
||||
diff --git a/gdb/language.h b/gdb/language.h
|
||||
--- a/gdb/language.h
|
||||
+++ b/gdb/language.h
|
||||
@@ -471,7 +471,7 @@ struct language_defn
|
||||
If that PC falls in a trampoline belonging to this language, return
|
||||
the address of the first pc in the real function, or 0 if it isn't a
|
||||
language tramp for this language. */
|
||||
- virtual CORE_ADDR skip_trampoline (frame_info_ptr fi, CORE_ADDR pc) const
|
||||
+ virtual CORE_ADDR skip_trampoline (const frame_info_ptr &fi, CORE_ADDR pc) const
|
||||
{
|
||||
return (CORE_ADDR) 0;
|
||||
}
|
||||
@@ -789,7 +789,7 @@ extern const char *language_str (enum language);
|
||||
|
||||
/* Check for a language-specific trampoline. */
|
||||
|
||||
-extern CORE_ADDR skip_language_trampoline (frame_info_ptr, CORE_ADDR pc);
|
||||
+extern CORE_ADDR skip_language_trampoline (const frame_info_ptr &, CORE_ADDR pc);
|
||||
|
||||
/* Return demangled language symbol, or NULL. */
|
||||
extern gdb::unique_xmalloc_ptr<char> language_demangle
|
||||
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
|
||||
--- a/gdb/objc-lang.c
|
||||
+++ b/gdb/objc-lang.c
|
||||
@@ -282,7 +282,7 @@ class objc_language : public language_defn
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
- CORE_ADDR skip_trampoline (frame_info_ptr frame,
|
||||
+ CORE_ADDR skip_trampoline (const frame_info_ptr &frame,
|
||||
CORE_ADDR stop_pc) const override
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
188
gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch
Normal file
188
gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch
Normal file
@@ -0,0 +1,188 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Burgess <aburgess@redhat.com>
|
||||
Date: Tue, 20 Jun 2023 09:46:35 +0100
|
||||
Subject: gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch
|
||||
|
||||
;; Backport upstream commit f3eee5861743d635 to fix a crash triggered
|
||||
;; when debuginfod makes use of particular openssl settings.
|
||||
|
||||
gdb/debuginfod: cleanup debuginfod earlier
|
||||
|
||||
A GDB crash was discovered on Fedora GDB that was tracked back to an
|
||||
issue with the way that debuginfod is cleaned up.
|
||||
|
||||
The bug was reported on Fedora 37, 38, and 39. Here are the steps to
|
||||
reproduce:
|
||||
|
||||
1. The file /etc/ssl/openssl.cnf contains the following lines:
|
||||
|
||||
[provider_sect]
|
||||
default = default_sect
|
||||
##legacy = legacy_sect
|
||||
##
|
||||
[default_sect]
|
||||
activate = 1
|
||||
|
||||
##[legacy_sect]
|
||||
##activate = 1
|
||||
|
||||
The bug will occur when the '##' characters are removed so that the
|
||||
lines in question look like this:
|
||||
|
||||
[provider_sect]
|
||||
default = default_sect
|
||||
legacy = legacy_sect
|
||||
|
||||
[default_sect]
|
||||
activate = 1
|
||||
|
||||
[legacy_sect]
|
||||
activate = 1
|
||||
|
||||
2. Clean up any existing debuginfod cache data:
|
||||
|
||||
> rm -rf $HOME/.cache/debuginfod_client
|
||||
|
||||
3. Run GDB:
|
||||
|
||||
> gdb -nx -q -iex 'set trace-commands on' \
|
||||
-iex 'set debuginfod enabled on' \
|
||||
-iex 'set confirm off' \
|
||||
-ex 'start' -ex 'quit' /bin/ls
|
||||
+set debuginfod enabled on
|
||||
+set confirm off
|
||||
Reading symbols from /bin/ls...
|
||||
Downloading separate debug info for /usr/bin/ls
|
||||
... snip ...
|
||||
Temporary breakpoint 1, main (argc=1, argv=0x7fffffffde38) at ../src/ls.c:1646
|
||||
1646 {
|
||||
+quit
|
||||
|
||||
Fatal signal: Segmentation fault
|
||||
----- Backtrace -----
|
||||
... snip ...
|
||||
|
||||
So GDB ends up crashing during exit.
|
||||
|
||||
What's happening is that when debuginfod is initialised
|
||||
debuginfod_begin is called (this is in the debuginfod library), this
|
||||
in turn sets up libcurl, which makes use of openssl. Somewhere during
|
||||
this setup process an at_exit function is registered to cleanup some
|
||||
state.
|
||||
|
||||
Back in GDB the debuginfod_client object is managed using this code:
|
||||
|
||||
/* Deleter for a debuginfod_client. */
|
||||
|
||||
struct debuginfod_client_deleter
|
||||
{
|
||||
void operator() (debuginfod_client *c)
|
||||
{
|
||||
debuginfod_end (c);
|
||||
}
|
||||
};
|
||||
|
||||
using debuginfod_client_up
|
||||
= std::unique_ptr<debuginfod_client, debuginfod_client_deleter>;
|
||||
|
||||
And then a global debuginfod_client_up is created to hold a pointer to
|
||||
the debuginfod_client object. As a global this will be cleaned up
|
||||
using the standard C++ global object destructor mechanism, which is
|
||||
run after the at_exit handlers.
|
||||
|
||||
However, it is expected that when debuginfod_end is called the
|
||||
debuginfod_client object will still be in a usable state, that is, we
|
||||
don't expect the at_exit handlers to have run and started cleaning up
|
||||
the library state.
|
||||
|
||||
To fix this issue we need to ensure that debuginfod_end is called
|
||||
before the at_exit handlers have a chance to run.
|
||||
|
||||
This commit removes the debuginfod_client_up type, and instead has GDB
|
||||
hold a raw pointer to the debuginfod_client object. We then make use
|
||||
of GDB's make_final_cleanup to register a function that will call
|
||||
debuginfod_end.
|
||||
|
||||
As GDB's final cleanups are called before exit is called, this means
|
||||
that debuginfod_end will be called before the at_exit handlers are
|
||||
called, and the crash identified above is resolved.
|
||||
|
||||
It's not obvious how this issue can easily be tested for. The bug does
|
||||
not appear to manifest when using a local debuginfod server, so we'd
|
||||
need to setup something more involved. For now I'm proposing this
|
||||
patch without any associated tests.
|
||||
|
||||
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
|
||||
--- a/gdb/debuginfod-support.c
|
||||
+++ b/gdb/debuginfod-support.c
|
||||
@@ -96,20 +96,6 @@ struct user_data
|
||||
ui_out::progress_update progress;
|
||||
};
|
||||
|
||||
-/* Deleter for a debuginfod_client. */
|
||||
-
|
||||
-struct debuginfod_client_deleter
|
||||
-{
|
||||
- void operator() (debuginfod_client *c)
|
||||
- {
|
||||
- debuginfod_end (c);
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-using debuginfod_client_up
|
||||
- = std::unique_ptr<debuginfod_client, debuginfod_client_deleter>;
|
||||
-
|
||||
-
|
||||
/* Convert SIZE into a unit suitable for use with progress updates.
|
||||
SIZE should in given in bytes and will be converted into KB, MB, GB
|
||||
or remain unchanged. UNIT will be set to "B", "KB", "MB" or "GB"
|
||||
@@ -180,20 +166,45 @@ progressfn (debuginfod_client *c, long cur, long total)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* Cleanup ARG, which is a debuginfod_client pointer. */
|
||||
+
|
||||
+static void
|
||||
+cleanup_debuginfod_client (void *arg)
|
||||
+{
|
||||
+ debuginfod_client *client = static_cast<debuginfod_client *> (arg);
|
||||
+ debuginfod_end (client);
|
||||
+}
|
||||
+
|
||||
+/* Return a pointer to the single global debuginfod_client, initialising it
|
||||
+ first if needed. */
|
||||
+
|
||||
static debuginfod_client *
|
||||
get_debuginfod_client ()
|
||||
{
|
||||
- static debuginfod_client_up global_client;
|
||||
+ static debuginfod_client *global_client = nullptr;
|
||||
|
||||
if (global_client == nullptr)
|
||||
{
|
||||
- global_client.reset (debuginfod_begin ());
|
||||
+ global_client = debuginfod_begin ();
|
||||
|
||||
if (global_client != nullptr)
|
||||
- debuginfod_set_progressfn (global_client.get (), progressfn);
|
||||
+ {
|
||||
+ /* It is important that we cleanup the debuginfod_client object
|
||||
+ before calling exit. Some of the libraries used by debuginfod
|
||||
+ make use of at_exit handlers to perform cleanup.
|
||||
+
|
||||
+ If we wrapped the debuginfod_client in a unique_ptr and relied
|
||||
+ on its destructor to cleanup then this would be run as part of
|
||||
+ the global C++ object destructors, which is after the at_exit
|
||||
+ handlers, which is too late.
|
||||
+
|
||||
+ So instead, we make use of GDB's final cleanup mechanism. */
|
||||
+ make_final_cleanup (cleanup_debuginfod_client, global_client);
|
||||
+ debuginfod_set_progressfn (global_client, progressfn);
|
||||
+ }
|
||||
}
|
||||
|
||||
- return global_client.get ();
|
||||
+ return global_client;
|
||||
}
|
||||
|
||||
/* Check if debuginfod is enabled. If configured to do so, ask the user
|
50
gdb-rhbz2233961-CVE-2022-4806.patch
Normal file
50
gdb-rhbz2233961-CVE-2022-4806.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
|
||||
Date: Thu, 21 Sep 2023 18:52:49 +0200
|
||||
Subject: gdb-rhbz2233961-CVE-2022-4806.patch
|
||||
|
||||
;; Backport PR29922, SHT_NOBITS section
|
||||
;; avoids section size sanity check.
|
||||
|
||||
PR29922, SHT_NOBITS section avoids section size sanity check
|
||||
|
||||
PR 29922
|
||||
* dwarf2.c (find_debug_info): Ignore sections without
|
||||
SEC_HAS_CONTENTS.
|
||||
|
||||
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
|
||||
--- a/bfd/dwarf2.c
|
||||
+++ b/bfd/dwarf2.c
|
||||
@@ -4831,16 +4831,19 @@ find_debug_info (bfd *abfd, const struct dwarf_debug_section *debug_sections,
|
||||
{
|
||||
look = debug_sections[debug_info].uncompressed_name;
|
||||
msec = bfd_get_section_by_name (abfd, look);
|
||||
- if (msec != NULL)
|
||||
+ /* Testing SEC_HAS_CONTENTS is an anti-fuzzer measure. Of
|
||||
+ course debug sections always have contents. */
|
||||
+ if (msec != NULL && (msec->flags & SEC_HAS_CONTENTS) != 0)
|
||||
return msec;
|
||||
|
||||
look = debug_sections[debug_info].compressed_name;
|
||||
msec = bfd_get_section_by_name (abfd, look);
|
||||
- if (msec != NULL)
|
||||
+ if (msec != NULL && (msec->flags & SEC_HAS_CONTENTS) != 0)
|
||||
return msec;
|
||||
|
||||
for (msec = abfd->sections; msec != NULL; msec = msec->next)
|
||||
- if (startswith (msec->name, GNU_LINKONCE_INFO))
|
||||
+ if ((msec->flags & SEC_HAS_CONTENTS) != 0
|
||||
+ && startswith (msec->name, GNU_LINKONCE_INFO))
|
||||
return msec;
|
||||
|
||||
return NULL;
|
||||
@@ -4848,6 +4851,9 @@ find_debug_info (bfd *abfd, const struct dwarf_debug_section *debug_sections,
|
||||
|
||||
for (msec = after_sec->next; msec != NULL; msec = msec->next)
|
||||
{
|
||||
+ if ((msec->flags & SEC_HAS_CONTENTS) == 0)
|
||||
+ continue;
|
||||
+
|
||||
look = debug_sections[debug_info].uncompressed_name;
|
||||
if (strcmp (msec->name, look) == 0)
|
||||
return msec;
|
115
gdb-rhbz2233965-memory-leak.patch
Normal file
115
gdb-rhbz2233965-memory-leak.patch
Normal file
@@ -0,0 +1,115 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
|
||||
Date: Sat, 14 Oct 2023 12:37:50 +0200
|
||||
Subject: gdb-rhbz2233965-memory-leak.patch
|
||||
|
||||
;; Backport PR29925, Memory leak in find_abstract_instance
|
||||
|
||||
PR29925, Memory leak in find_abstract_instance
|
||||
|
||||
The testcase in the PR had a variable with both DW_AT_decl_file and
|
||||
DW_AT_specification, where the DW_AT_specification also specified
|
||||
DW_AT_decl_file. This leads to a memory leak as the file name is
|
||||
malloced and duplicates are not expected.
|
||||
|
||||
I've also changed find_abstract_instance to not use a temp for "name",
|
||||
because that can result in a change in behaviour from the usual last
|
||||
of duplicate attributes wins.
|
||||
|
||||
PR 29925
|
||||
* dwarf2.c (find_abstract_instance): Delete "name" variable.
|
||||
Free *filename_ptr before assigning new file name.
|
||||
(scan_unit_for_symbols): Similarly free func->file and
|
||||
var->file before assigning.
|
||||
|
||||
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
|
||||
--- a/bfd/dwarf2.c
|
||||
+++ b/bfd/dwarf2.c
|
||||
@@ -3441,7 +3441,6 @@ find_abstract_instance (struct comp_unit *unit,
|
||||
struct abbrev_info *abbrev;
|
||||
uint64_t die_ref = attr_ptr->u.val;
|
||||
struct attribute attr;
|
||||
- const char *name = NULL;
|
||||
|
||||
if (recur_count == 100)
|
||||
{
|
||||
@@ -3602,9 +3601,9 @@ find_abstract_instance (struct comp_unit *unit,
|
||||
case DW_AT_name:
|
||||
/* Prefer DW_AT_MIPS_linkage_name or DW_AT_linkage_name
|
||||
over DW_AT_name. */
|
||||
- if (name == NULL && is_str_form (&attr))
|
||||
+ if (*pname == NULL && is_str_form (&attr))
|
||||
{
|
||||
- name = attr.u.str;
|
||||
+ *pname = attr.u.str;
|
||||
if (mangle_style (unit->lang) == 0)
|
||||
*is_linkage = true;
|
||||
}
|
||||
@@ -3612,7 +3611,7 @@ find_abstract_instance (struct comp_unit *unit,
|
||||
case DW_AT_specification:
|
||||
if (is_int_form (&attr)
|
||||
&& !find_abstract_instance (unit, &attr, recur_count + 1,
|
||||
- &name, is_linkage,
|
||||
+ pname, is_linkage,
|
||||
filename_ptr, linenumber_ptr))
|
||||
return false;
|
||||
break;
|
||||
@@ -3622,7 +3621,7 @@ find_abstract_instance (struct comp_unit *unit,
|
||||
non-string forms into these attributes. */
|
||||
if (is_str_form (&attr))
|
||||
{
|
||||
- name = attr.u.str;
|
||||
+ *pname = attr.u.str;
|
||||
*is_linkage = true;
|
||||
}
|
||||
break;
|
||||
@@ -3630,8 +3629,11 @@ find_abstract_instance (struct comp_unit *unit,
|
||||
if (!comp_unit_maybe_decode_line_info (unit))
|
||||
return false;
|
||||
if (is_int_form (&attr))
|
||||
- *filename_ptr = concat_filename (unit->line_table,
|
||||
- attr.u.val);
|
||||
+ {
|
||||
+ free (*filename_ptr);
|
||||
+ *filename_ptr = concat_filename (unit->line_table,
|
||||
+ attr.u.val);
|
||||
+ }
|
||||
break;
|
||||
case DW_AT_decl_line:
|
||||
if (is_int_form (&attr))
|
||||
@@ -3643,7 +3645,6 @@ find_abstract_instance (struct comp_unit *unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
- *pname = name;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4139,8 +4140,11 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
||||
|
||||
case DW_AT_decl_file:
|
||||
if (is_int_form (&attr))
|
||||
- func->file = concat_filename (unit->line_table,
|
||||
- attr.u.val);
|
||||
+ {
|
||||
+ free (func->file);
|
||||
+ func->file = concat_filename (unit->line_table,
|
||||
+ attr.u.val);
|
||||
+ }
|
||||
break;
|
||||
|
||||
case DW_AT_decl_line:
|
||||
@@ -4182,8 +4186,11 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
||||
|
||||
case DW_AT_decl_file:
|
||||
if (is_int_form (&attr))
|
||||
- var->file = concat_filename (unit->line_table,
|
||||
- attr.u.val);
|
||||
+ {
|
||||
+ free (var->file);
|
||||
+ var->file = concat_filename (unit->line_table,
|
||||
+ attr.u.val);
|
||||
+ }
|
||||
break;
|
||||
|
||||
case DW_AT_decl_line:
|
147
gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Normal file
147
gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Normal file
@@ -0,0 +1,147 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
|
||||
|
||||
;; Import regression test for `gdb/findvar.c:417: internal-error:
|
||||
;; read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.cc b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc
|
||||
@@ -0,0 +1,53 @@
|
||||
+#include <iostream>
|
||||
+#include <pthread.h>
|
||||
+
|
||||
+class x
|
||||
+ {
|
||||
+ public:
|
||||
+ int n;
|
||||
+
|
||||
+ x() : n(0) {}
|
||||
+ };
|
||||
+
|
||||
+class y
|
||||
+ {
|
||||
+ public:
|
||||
+ int v;
|
||||
+
|
||||
+ y() : v(0) {}
|
||||
+ static __thread x *xp;
|
||||
+ };
|
||||
+
|
||||
+__thread x *y::xp;
|
||||
+
|
||||
+static void
|
||||
+foo (y *yp)
|
||||
+{
|
||||
+ yp->v = 1; /* foo_marker */
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+bar (void *unused)
|
||||
+{
|
||||
+ x xinst;
|
||||
+ y::xp= &xinst;
|
||||
+
|
||||
+ y yy;
|
||||
+ foo(&yy);
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(int argc, char *argv[])
|
||||
+{
|
||||
+ pthread_t t[2];
|
||||
+
|
||||
+ pthread_create (&t[0], NULL, bar, NULL);
|
||||
+ pthread_create (&t[1], NULL, bar, NULL);
|
||||
+
|
||||
+ pthread_join (t[0], NULL);
|
||||
+ pthread_join (t[1], NULL);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.exp b/gdb/testsuite/gdb.threads/tls-rhbz947564.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/tls-rhbz947564.exp
|
||||
@@ -0,0 +1,75 @@
|
||||
+# Copyright (C) 2013 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/>. */
|
||||
+
|
||||
+set testfile tls-rhbz947564
|
||||
+set srcfile ${testfile}.cc
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if [istarget "*-*-linux"] then {
|
||||
+ set target_cflags "-D_MIT_POSIX_THREADS"
|
||||
+} else {
|
||||
+ set target_cflags ""
|
||||
+}
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list c++ debug]] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ fail "Can't run to function main"
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint "foo"
|
||||
+gdb_continue_to_breakpoint "foo" ".* foo_marker .*"
|
||||
+
|
||||
+proc get_xp_val {try} {
|
||||
+ global expect_out
|
||||
+ global gdb_prompt
|
||||
+ global hex
|
||||
+
|
||||
+ set xp_val ""
|
||||
+ gdb_test_multiple "print *yp" "print yp value" {
|
||||
+ -re { = \{v = 0, static xp = (0x[0-9a-f]+)\}.* } {
|
||||
+ pass "print $try value of *yp"
|
||||
+ set xp_val $expect_out(1,string)
|
||||
+ }
|
||||
+ -re "$gdb_prompt $" {
|
||||
+ fail "print $try value of *yp"
|
||||
+ }
|
||||
+ timeout {
|
||||
+ fail "print $try value of *yp (timeout)"
|
||||
+ }
|
||||
+ }
|
||||
+ return $xp_val
|
||||
+}
|
||||
+
|
||||
+set first_run [get_xp_val "first"]
|
||||
+
|
||||
+gdb_test "continue" "Breakpoint \[0-9\]+, foo \\\(yp=$hex\\\) at.*"
|
||||
+
|
||||
+set second_run [get_xp_val "second"]
|
||||
+
|
||||
+if { $first_run != $second_run } {
|
||||
+ pass "different values for TLS variable"
|
||||
+} else {
|
||||
+ fail "different values for TLS variable"
|
||||
+}
|
731
gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
Normal file
731
gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
Normal file
@@ -0,0 +1,731 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
|
||||
|
||||
;; Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.S b/gdb/testsuite/gdb.fortran/xlf-variable.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/xlf-variable.S
|
||||
@@ -0,0 +1,638 @@
|
||||
+/* Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ 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 has been generated from the file named `xlf-variable.f', which
|
||||
+ should be present in this directory. The command used to generate this
|
||||
+ file was:
|
||||
+
|
||||
+ xlf -qnoopt -g9 -S xlf-variable.f -o xlf-variable.S
|
||||
+
|
||||
+ After issuing this command, you must hand-edit this file and remove the
|
||||
+ mentions for `_xlfExit', since it is only present in XLF-specific
|
||||
+ libraries. You must also make sure to remove the file named `mod1.mod'
|
||||
+ which will be created in the compilation directory.
|
||||
+
|
||||
+ In order to generated this file, the following XLF package was used:
|
||||
+
|
||||
+ xlf.14.1.0.0.linux.eval.tar.gz
|
||||
+
|
||||
+ These instructions may be different for different versions of the XLF
|
||||
+ compiler. */
|
||||
+
|
||||
+.set r0,0; .set SP,1; .set RTOC,2; .set r3,3; .set r4,4
|
||||
+.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
|
||||
+.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
|
||||
+.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
|
||||
+.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
|
||||
+.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
|
||||
+.set r30,30; .set r31,31
|
||||
+.set fp0,0; .set fp1,1; .set fp2,2; .set fp3,3; .set fp4,4
|
||||
+.set fp5,5; .set fp6,6; .set fp7,7; .set fp8,8; .set fp9,9
|
||||
+.set fp10,10; .set fp11,11; .set fp12,12; .set fp13,13; .set fp14,14
|
||||
+.set fp15,15; .set fp16,16; .set fp17,17; .set fp18,18; .set fp19,19
|
||||
+.set fp20,20; .set fp21,21; .set fp22,22; .set fp23,23; .set fp24,24
|
||||
+.set fp25,25; .set fp26,26; .set fp27,27; .set fp28,28; .set fp29,29
|
||||
+.set fp30,30; .set fp31,31
|
||||
+.set v0,0; .set v1,1; .set v2,2; .set v3,3; .set v4,4
|
||||
+.set v5,5; .set v6,6; .set v7,7; .set v8,8; .set v9,9
|
||||
+.set v10,10; .set v11,11; .set v12,12; .set v13,13; .set v14,14
|
||||
+.set v15,15; .set v16,16; .set v17,17; .set v18,18; .set v19,19
|
||||
+.set v20,20; .set v21,21; .set v22,22; .set v23,23; .set v24,24
|
||||
+.set v25,25; .set v26,26; .set v27,27; .set v28,28; .set v29,29
|
||||
+.set v30,30; .set v31,31
|
||||
+.set q0,0; .set q1,1; .set q2,2; .set q3,3; .set q4,4
|
||||
+.set q5,5; .set q6,6; .set q7,7; .set q8,8; .set q9,9
|
||||
+.set q10,10; .set q11,11; .set q12,12; .set q13,13; .set q14,14
|
||||
+.set q15,15; .set q16,16; .set q17,17; .set q18,18; .set q19,19
|
||||
+.set q20,20; .set q21,21; .set q22,22; .set q23,23; .set q24,24
|
||||
+.set q25,25; .set q26,26; .set q27,27; .set q28,28; .set q29,29
|
||||
+.set q30,30; .set q31,31
|
||||
+.set MQ,0; .set XER,1; .set FROM_RTCU,4; .set FROM_RTCL,5; .set FROM_DEC,6
|
||||
+.set LR,8; .set CTR,9; .set TID,17; .set DSISR,18; .set DAR,19; .set TO_RTCU,20
|
||||
+.set TO_RTCL,21; .set TO_DEC,22; .set SDR_0,24; .set SDR_1,25; .set SRR_0,26
|
||||
+.set SRR_1,27
|
||||
+.set BO_dCTR_NZERO_AND_NOT,0; .set BO_dCTR_NZERO_AND_NOT_1,1
|
||||
+.set BO_dCTR_ZERO_AND_NOT,2; .set BO_dCTR_ZERO_AND_NOT_1,3
|
||||
+.set BO_IF_NOT,4; .set BO_IF_NOT_1,5; .set BO_IF_NOT_2,6
|
||||
+.set BO_IF_NOT_3,7; .set BO_dCTR_NZERO_AND,8; .set BO_dCTR_NZERO_AND_1,9
|
||||
+.set BO_dCTR_ZERO_AND,10; .set BO_dCTR_ZERO_AND_1,11; .set BO_IF,12
|
||||
+.set BO_IF_1,13; .set BO_IF_2,14; .set BO_IF_3,15; .set BO_dCTR_NZERO,16
|
||||
+.set BO_dCTR_NZERO_1,17; .set BO_dCTR_ZERO,18; .set BO_dCTR_ZERO_1,19
|
||||
+.set BO_ALWAYS,20; .set BO_ALWAYS_1,21; .set BO_ALWAYS_2,22
|
||||
+.set BO_ALWAYS_3,23; .set BO_dCTR_NZERO_8,24; .set BO_dCTR_NZERO_9,25
|
||||
+.set BO_dCTR_ZERO_8,26; .set BO_dCTR_ZERO_9,27; .set BO_ALWAYS_8,28
|
||||
+.set BO_ALWAYS_9,29; .set BO_ALWAYS_10,30; .set BO_ALWAYS_11,31
|
||||
+.set CR0_LT,0; .set CR0_GT,1; .set CR0_EQ,2; .set CR0_SO,3
|
||||
+.set CR1_FX,4; .set CR1_FEX,5; .set CR1_VX,6; .set CR1_OX,7
|
||||
+.set CR2_LT,8; .set CR2_GT,9; .set CR2_EQ,10; .set CR2_SO,11
|
||||
+.set CR3_LT,12; .set CR3_GT,13; .set CR3_EQ,14; .set CR3_SO,15
|
||||
+.set CR4_LT,16; .set CR4_GT,17; .set CR4_EQ,18; .set CR4_SO,19
|
||||
+.set CR5_LT,20; .set CR5_GT,21; .set CR5_EQ,22; .set CR5_SO,23
|
||||
+.set CR6_LT,24; .set CR6_GT,25; .set CR6_EQ,26; .set CR6_SO,27
|
||||
+.set CR7_LT,28; .set CR7_GT,29; .set CR7_EQ,30; .set CR7_SO,31
|
||||
+.set TO_LT,16; .set TO_GT,8; .set TO_EQ,4; .set TO_LLT,2; .set TO_LGT,1
|
||||
+
|
||||
+ .file "xlf-variable.f"
|
||||
+ .globl __mod1_NMOD_____mod1
|
||||
+ .type __mod1_NMOD_____mod1,@function
|
||||
+ .size __mod1_NMOD_____mod1,32
|
||||
+ .globl main
|
||||
+ .type main,@function
|
||||
+ .size main,68
|
||||
+ .globl __mod1_NMOD_sub1
|
||||
+ .type __mod1_NMOD_sub1,@function
|
||||
+ .size __mod1_NMOD_sub1,136
|
||||
+ .globl _main
|
||||
+ .type _main,@function
|
||||
+ .size _main,68
|
||||
+
|
||||
+ .section ".text"
|
||||
+ .align 7
|
||||
+.LC.text:
|
||||
+__mod1_NMOD_____mod1:
|
||||
+ stwu SP,-32(SP)
|
||||
+ stw r31,28(SP)
|
||||
+ or r31,SP,SP
|
||||
+ b $+0x4
|
||||
+ addi r11,r31,32
|
||||
+ lwz r31,-4(r11)
|
||||
+ or SP,r11,r11
|
||||
+ bclr BO_ALWAYS,CR0_LT
|
||||
+.LC.text32:
|
||||
+
|
||||
+__mod1_NMOD_sub1:
|
||||
+ stwu SP,-32(SP)
|
||||
+ stw r31,28(SP)
|
||||
+ stw r30,24(SP)
|
||||
+ or r31,SP,SP
|
||||
+ addis r30,r0,.const_dr@ha
|
||||
+ addi r30,r30,.const_dr@l
|
||||
+ addis r3,r0,__N_mod1@ha
|
||||
+ addi r3,r3,__N_mod1@l
|
||||
+ addi r0,r0,1
|
||||
+ stb r0,4(r3)
|
||||
+ addi r4,r0,14
|
||||
+ stb r4,5(r3)
|
||||
+ stb r0,7(r3)
|
||||
+ addis r5,r0,__N__mod1@ha
|
||||
+ addi r5,r5,__N__mod1@l
|
||||
+ stw r5,0(r3)
|
||||
+ lbz r5,6(r3)
|
||||
+ rlwinm r5,r5,0,25,25
|
||||
+ ori r5,r5,0x0040
|
||||
+ stb r5,6(r3)
|
||||
+ lwz r5,0(r3)
|
||||
+ lfs fp0,0(r30)
|
||||
+ stfs fp0,0(r5)
|
||||
+ stb r0,4(r3)
|
||||
+ stb r4,5(r3)
|
||||
+ addi r4,r0,0
|
||||
+ stb r4,6(r3)
|
||||
+ stb r0,7(r3)
|
||||
+ b $+0x4
|
||||
+ addi r11,r31,32
|
||||
+ lwz r30,-8(r11)
|
||||
+ lwz r31,-4(r11)
|
||||
+ or SP,r11,r11
|
||||
+ bclr BO_ALWAYS,CR0_LT
|
||||
+.LC.text168:
|
||||
+ .long 0
|
||||
+ .skip 0x54
|
||||
+.LC.text256:
|
||||
+
|
||||
+main:
|
||||
+_main:
|
||||
+ mfspr r0,LR
|
||||
+ stwu SP,-32(SP)
|
||||
+ stw r31,28(SP)
|
||||
+ stw r0,36(SP)
|
||||
+ or r31,SP,SP
|
||||
+ bl __mod1_NMOD_sub1
|
||||
+ addi r3,r0,0
|
||||
+.LC.text288:
|
||||
+
|
||||
+ tw TO_EQ,r14,r14
|
||||
+ addi r3,r0,0
|
||||
+ b $+0x4
|
||||
+ addi r11,r31,32
|
||||
+ lwz r31,-4(r11)
|
||||
+ lwz r0,4(r11)
|
||||
+ mtspr LR,r0
|
||||
+ or SP,r11,r11
|
||||
+ bclr BO_ALWAYS,CR0_LT
|
||||
+.LC.text324:
|
||||
+
|
||||
+
|
||||
+ .section ".rodata","a"
|
||||
+ .align 2
|
||||
+.LC.rodata:
|
||||
+ .type .const_dr,@object
|
||||
+ .size .const_dr,4
|
||||
+.const_dr:
|
||||
+ .long 0x40400000
|
||||
+
|
||||
+ .section ".eh_frame","wa"
|
||||
+ .align 2
|
||||
+.LC.eh_frame:
|
||||
+ .long 0x0000000c
|
||||
+ .long 0x00000000
|
||||
+ .long 0x0100047c
|
||||
+ .long 0x410c0100
|
||||
+ .long 0x0000001c
|
||||
+ .long 0x00000014
|
||||
+ .long .LC.text
|
||||
+ .long 0x00000020
|
||||
+ .long 0x410e2041
|
||||
+ .long 0x9f01410d
|
||||
+ .long 0x1f410a42
|
||||
+ .long 0xdf420b00
|
||||
+ .long 0x00000020
|
||||
+ .long 0x00000034
|
||||
+ .long .LC.text32
|
||||
+ .long 0x00000088
|
||||
+ .long 0x410e2041
|
||||
+ .long 0x9f01419e
|
||||
+ .long 0x02410d1f
|
||||
+ .long 0x590a42de
|
||||
+ .long 0x41df420b
|
||||
+ .long 0x0000000c
|
||||
+ .long 0x00000000
|
||||
+ .long 0x0100047c
|
||||
+ .long 0x410c0100
|
||||
+ .long 0x00000020
|
||||
+ .long 0x00000014
|
||||
+ .long .LC.text256
|
||||
+ .long 0x00000044
|
||||
+ .long 0x420e2041
|
||||
+ .long 0x9f014111
|
||||
+ .long 0x417f410d
|
||||
+ .long 0x1f460a42
|
||||
+ .long 0xdf440b00
|
||||
+
|
||||
+ .section ".data","wa"
|
||||
+ .align 4
|
||||
+.LC.data:
|
||||
+ .globl __N_mod1
|
||||
+ .type __N_mod1,@object
|
||||
+ .size __N_mod1,8
|
||||
+__N_mod1:
|
||||
+ .long 0x00000000
|
||||
+ .long 0x01000001
|
||||
+
|
||||
+ .section ".except.1","wa"
|
||||
+ .align 1
|
||||
+.LC.except.1:
|
||||
+ .long .LC.text288
|
||||
+ .byte 0x01
|
||||
+ .byte 0x09
|
||||
+
|
||||
+ .ident "Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000.Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000."
|
||||
+
|
||||
+ .section ".debug_aranges"
|
||||
+ .align 0
|
||||
+.LC.debug_aranges:
|
||||
+ .long 0x0000001c
|
||||
+ .byte 0x00
|
||||
+ .byte 0x02
|
||||
+ .long .LC.debug_info
|
||||
+ .long 0x04000000
|
||||
+ .byte 0x00
|
||||
+ .byte 0x00
|
||||
+ .long .LC.text
|
||||
+ .long 0x000000a8
|
||||
+ .long 0x00000000
|
||||
+ .long 0x00000000
|
||||
+ .long 0x0000001c
|
||||
+ .byte 0x00
|
||||
+ .byte 0x02
|
||||
+ .long .LC.debug_info273
|
||||
+ .long 0x04000000
|
||||
+ .byte 0x00
|
||||
+ .byte 0x00
|
||||
+ .long .LC.text256
|
||||
+ .long 0x00000044
|
||||
+ .long 0x00000000
|
||||
+ .long 0x00000000
|
||||
+
|
||||
+ .section ".debug_pubnames"
|
||||
+ .align 0
|
||||
+.LC.debug_pubnames:
|
||||
+ .long 0x0000002f
|
||||
+ .byte 0x00
|
||||
+ .byte 0x02
|
||||
+ .long .LC.debug_info
|
||||
+ .long 0x00000111
|
||||
+ .long 0x000000dc
|
||||
+ .long 0x79000000
|
||||
+ .long 0x00ec7a00
|
||||
+ .long 0x000000fc
|
||||
+ .long 0x5f5f6d6f
|
||||
+ .long 0x64315f4e
|
||||
+ .long 0x4d4f445f
|
||||
+ .long 0x73756231
|
||||
+ .long 0x00000000
|
||||
+ .long 0x00000000
|
||||
+ .byte 0x18
|
||||
+ .byte 0x00
|
||||
+ .byte 0x02
|
||||
+ .long .LC.debug_info273
|
||||
+ .long 0x00000127
|
||||
+ .long 0x0000010f
|
||||
+ .long 0x5f6d6169
|
||||
+ .long 0x6e000000
|
||||
+ .byte 0x00
|
||||
+ .byte 0x00
|
||||
+
|
||||
+ .section ".debug_info"
|
||||
+ .align 0
|
||||
+.LC.debug_info:
|
||||
+ .long 0x0000010d
|
||||
+ .byte 0x00
|
||||
+ .byte 0x02
|
||||
+ .long .LC.debug_abbrev
|
||||
+ .long 0x0401786c
|
||||
+ .long 0x662d7661
|
||||
+ .long 0x72696162
|
||||
+ .long 0x6c652e66
|
||||
+ .byte 0x00
|
||||
+ .long .LC.debug_line
|
||||
+ .long .LC.text
|
||||
+ .long .LC.text168
|
||||
+ .long 0x082f726f
|
||||
+ .long 0x6f742f73
|
||||
+ .long 0x65726769
|
||||
+ .long 0x6f646a2f
|
||||
+ .long 0x6764622d
|
||||
+ .long 0x372e302e
|
||||
+ .long 0x312d3432
|
||||
+ .long 0x2e656c35
|
||||
+ .long 0x2f676462
|
||||
+ .long 0x2d372e30
|
||||
+ .long 0x2e312f67
|
||||
+ .long 0x64622f74
|
||||
+ .long 0x65737473
|
||||
+ .long 0x75697465
|
||||
+ .long 0x2f676462
|
||||
+ .long 0x2e666f72
|
||||
+ .long 0x7472616e
|
||||
+ .long 0x0049424d
|
||||
+ .long 0x20584c20
|
||||
+ .long 0x466f7274
|
||||
+ .long 0x72616e20
|
||||
+ .long 0x666f7220
|
||||
+ .long 0x4c696e75
|
||||
+ .long 0x782c2056
|
||||
+ .long 0x31342e31
|
||||
+ .long 0x20283537
|
||||
+ .long 0x36352d4a
|
||||
+ .long 0x30352c20
|
||||
+ .long 0x35373235
|
||||
+ .long 0x2d433735
|
||||
+ .long 0x29205665
|
||||
+ .long 0x7273696f
|
||||
+ .long 0x6e203134
|
||||
+ .long 0x2e30312e
|
||||
+ .long 0x30303030
|
||||
+ .long 0x2e303030
|
||||
+ .long 0x30000249
|
||||
+ .long 0x4e544547
|
||||
+ .long 0x45520004
|
||||
+ .long 0x05030005
|
||||
+ .long 0x02524541
|
||||
+ .long 0x4c000404
|
||||
+ .long 0x04050000
|
||||
+ .long 0x0000c706
|
||||
+ .long 0x6d6f6431
|
||||
+ .long 0x00070503
|
||||
+ .long __N_mod1
|
||||
+ .long 0x79000100
|
||||
+ .long 0x01000000
|
||||
+ .long 0xd0070503
|
||||
+ .long __N__mod1
|
||||
+ .long 0x7a000100
|
||||
+ .long 0x01000000
|
||||
+ .long 0xc7087375
|
||||
+ .byte 0x62
|
||||
+ .byte 0x31
|
||||
+ .byte 0x00
|
||||
+ .long .LC.text32
|
||||
+ .long .LC.text168
|
||||
+ .long 0x01180101
|
||||
+ .byte 0x6f
|
||||
+ .byte 0x00
|
||||
+ .byte 0x00
|
||||
+.LC.debug_info273:
|
||||
+ .long 0x00000123
|
||||
+ .byte 0x00
|
||||
+ .byte 0x02
|
||||
+ .long .LC.debug_abbrev97
|
||||
+ .long 0x0401786c
|
||||
+ .long 0x662d7661
|
||||
+ .long 0x72696162
|
||||
+ .long 0x6c652e66
|
||||
+ .byte 0x00
|
||||
+ .long .LC.debug_line98
|
||||
+ .long .LC.text256
|
||||
+ .long .LC.text324
|
||||
+ .long 0x082f726f
|
||||
+ .long 0x6f742f73
|
||||
+ .long 0x65726769
|
||||
+ .long 0x6f646a2f
|
||||
+ .long 0x6764622d
|
||||
+ .long 0x372e302e
|
||||
+ .long 0x312d3432
|
||||
+ .long 0x2e656c35
|
||||
+ .long 0x2f676462
|
||||
+ .long 0x2d372e30
|
||||
+ .long 0x2e312f67
|
||||
+ .long 0x64622f74
|
||||
+ .long 0x65737473
|
||||
+ .long 0x75697465
|
||||
+ .long 0x2f676462
|
||||
+ .long 0x2e666f72
|
||||
+ .long 0x7472616e
|
||||
+ .long 0x0049424d
|
||||
+ .long 0x20584c20
|
||||
+ .long 0x466f7274
|
||||
+ .long 0x72616e20
|
||||
+ .long 0x666f7220
|
||||
+ .long 0x4c696e75
|
||||
+ .long 0x782c2056
|
||||
+ .long 0x31342e31
|
||||
+ .long 0x20283537
|
||||
+ .long 0x36352d4a
|
||||
+ .long 0x30352c20
|
||||
+ .long 0x35373235
|
||||
+ .long 0x2d433735
|
||||
+ .long 0x29205665
|
||||
+ .long 0x7273696f
|
||||
+ .long 0x6e203134
|
||||
+ .long 0x2e30312e
|
||||
+ .long 0x30303030
|
||||
+ .long 0x2e303030
|
||||
+ .long 0x30000249
|
||||
+ .long 0x4e544547
|
||||
+ .long 0x45520004
|
||||
+ .long 0x05030005
|
||||
+ .long 0x02524541
|
||||
+ .long 0x4c000404
|
||||
+ .long 0x04000000
|
||||
+ .long 0xb9050000
|
||||
+ .long 0x0000c706
|
||||
+ .long 0x000000f4
|
||||
+ .long 0x26264e26
|
||||
+ .long 0x6d6f6431
|
||||
+ .long 0x00080779
|
||||
+ .long 0x00022300
|
||||
+ .long 0x000000d4
|
||||
+ .long 0x00060000
|
||||
+ .long 0x010f2626
|
||||
+ .long 0x4e26266d
|
||||
+ .long 0x6f643100
|
||||
+ .long 0x04077a00
|
||||
+ .long 0x02230000
|
||||
+ .long 0x0000c700
|
||||
+ .long 0x085f6d61
|
||||
+ .byte 0x69
|
||||
+ .byte 0x6e
|
||||
+ .byte 0x00
|
||||
+ .long .LC.text256
|
||||
+ .long .LC.text324
|
||||
+ .long 0x0201016f
|
||||
+ .long 0x000000b9
|
||||
+ .byte 0x00
|
||||
+
|
||||
+ .section ".debug_abbrev"
|
||||
+ .align 0
|
||||
+.LC.debug_abbrev:
|
||||
+ .long 0x01110103
|
||||
+ .long 0x08100611
|
||||
+ .long 0x01120113
|
||||
+ .long 0x0b1b0825
|
||||
+ .long 0x08000002
|
||||
+ .long 0x24000308
|
||||
+ .long 0x0b0b3e0b
|
||||
+ .long 0x00000324
|
||||
+ .long 0x000b0b3e
|
||||
+ .long 0x0b000004
|
||||
+ .long 0x15000000
|
||||
+ .long 0x050f0033
|
||||
+ .long 0x0b491300
|
||||
+ .long 0x00061e01
|
||||
+ .long 0x03080000
|
||||
+ .long 0x07340002
|
||||
+ .long 0x0a03083a
|
||||
+ .long 0x0b3b0b3f
|
||||
+ .long 0x0c491300
|
||||
+ .long 0x00082e00
|
||||
+ .long 0x03081101
|
||||
+ .long 0x12013a0b
|
||||
+ .long 0x3b0b3f0c
|
||||
+ .long 0x400a0000
|
||||
+ .byte 0x00
|
||||
+.LC.debug_abbrev97:
|
||||
+ .long 0x01110103
|
||||
+ .long 0x08100611
|
||||
+ .long 0x01120113
|
||||
+ .long 0x0b1b0825
|
||||
+ .long 0x08000002
|
||||
+ .long 0x24000308
|
||||
+ .long 0x0b0b3e0b
|
||||
+ .long 0x00000324
|
||||
+ .long 0x000b0b3e
|
||||
+ .long 0x0b000004
|
||||
+ .long 0x15004913
|
||||
+ .long 0x0000050f
|
||||
+ .long 0x00330b49
|
||||
+ .long 0x13000006
|
||||
+ .long 0x13010113
|
||||
+ .long 0x03080b0b
|
||||
+ .long 0x0000070d
|
||||
+ .long 0x00030838
|
||||
+ .long 0x0a491300
|
||||
+ .long 0x00082e00
|
||||
+ .long 0x03081101
|
||||
+ .long 0x1201360b
|
||||
+ .long 0x3f0c400a
|
||||
+ .long 0x49130000
|
||||
+ .byte 0x00
|
||||
+
|
||||
+ .section ".debug_line"
|
||||
+ .align 0
|
||||
+.LC.debug_line:
|
||||
+ .long 0x0000005e
|
||||
+ .long 0x00020000
|
||||
+ .long 0x00220101
|
||||
+ .long 0x9cdc0a00
|
||||
+ .long 0x01010101
|
||||
+ .long 0x00000001
|
||||
+ .long 0x00786c66
|
||||
+ .long 0x2d766172
|
||||
+ .long 0x6961626c
|
||||
+ .long 0x652e6600
|
||||
+ .long 0x00000000
|
||||
+ .long 0x04010005
|
||||
+ .byte 0x02
|
||||
+ .long .LC.text
|
||||
+ .long 0x03130109
|
||||
+ .long 0x000c0309
|
||||
+ .long 0x01090014
|
||||
+ .long 0x037b0109
|
||||
+ .long 0x00180301
|
||||
+ .long 0x01090038
|
||||
+ .long 0x03010109
|
||||
+ .long 0x000c0301
|
||||
+ .long 0x01090014
|
||||
+ .long 0x03010109
|
||||
+ .long 0x00180001
|
||||
+ .byte 0x01
|
||||
+.LC.debug_line98:
|
||||
+ .long 0x00000046
|
||||
+ .long 0x00020000
|
||||
+ .long 0x00220101
|
||||
+ .long 0x9cdc0a00
|
||||
+ .long 0x01010101
|
||||
+ .long 0x00000001
|
||||
+ .long 0x00786c66
|
||||
+ .long 0x2d766172
|
||||
+ .long 0x6961626c
|
||||
+ .long 0x652e6600
|
||||
+ .long 0x00000000
|
||||
+ .long 0x04010005
|
||||
+ .byte 0x02
|
||||
+ .long .LC.text256
|
||||
+ .long 0x031f0109
|
||||
+ .long 0x00140300
|
||||
+ .long 0x01090004
|
||||
+ .long 0x03010109
|
||||
+ .long 0x002c0001
|
||||
+ .byte 0x01
|
||||
+
|
||||
+ .section ".debug_frame"
|
||||
+ .align 0
|
||||
+.LC.debug_frame:
|
||||
+ .long 0x0000000c
|
||||
+ .long 0xffffffff
|
||||
+ .long 0x0100047c
|
||||
+ .long 0x410c0100
|
||||
+ .long 0x0000001c
|
||||
+ .long .LC.debug_frame
|
||||
+ .long .LC.text
|
||||
+ .long 0x00000020
|
||||
+ .long 0x410e2041
|
||||
+ .long 0x9f01410d
|
||||
+ .long 0x1f410a42
|
||||
+ .long 0xdf420b00
|
||||
+ .long 0x00000020
|
||||
+ .long .LC.debug_frame
|
||||
+ .long .LC.text32
|
||||
+ .long 0x00000088
|
||||
+ .long 0x410e2041
|
||||
+ .long 0x9f01419e
|
||||
+ .long 0x02410d1f
|
||||
+ .long 0x590a42de
|
||||
+ .long 0x41df420b
|
||||
+.LC.debug_frame84:
|
||||
+ .long 0x0000000c
|
||||
+ .long 0xffffffff
|
||||
+ .long 0x0100047c
|
||||
+ .long 0x410c0100
|
||||
+ .long 0x00000020
|
||||
+ .long .LC.debug_frame84
|
||||
+ .long .LC.text256
|
||||
+ .long 0x00000044
|
||||
+ .long 0x420e2041
|
||||
+ .long 0x9f014111
|
||||
+ .long 0x417f410d
|
||||
+ .long 0x1f460a42
|
||||
+ .long 0xdf440b00
|
||||
+
|
||||
+ .section ".debug_pubtypes"
|
||||
+ .align 0
|
||||
+.LC.debug_pubtypes:
|
||||
+ .long 0x00000023
|
||||
+ .byte 0x00
|
||||
+ .byte 0x02
|
||||
+ .long .LC.debug_info
|
||||
+ .long 0x00000111
|
||||
+ .long 0x000000b9
|
||||
+ .long 0x494e5445
|
||||
+ .long 0x47455200
|
||||
+ .long 0x000000c7
|
||||
+ .long 0x5245414c
|
||||
+ .long 0x00000000
|
||||
+ .long 0x00000000
|
||||
+ .byte 0x3e
|
||||
+ .byte 0x00
|
||||
+ .byte 0x02
|
||||
+ .long .LC.debug_info273
|
||||
+ .long 0x00000127
|
||||
+ .long 0x000000b9
|
||||
+ .long 0x494e5445
|
||||
+ .long 0x47455200
|
||||
+ .long 0x000000c7
|
||||
+ .long 0x5245414c
|
||||
+ .long 0x00000000
|
||||
+ .long 0xda26264e
|
||||
+ .long 0x266d6f64
|
||||
+ .long 0x31000000
|
||||
+ .long 0x00f42626
|
||||
+ .long 0x4e26266d
|
||||
+ .long 0x6f643100
|
||||
+ .long 0x00000000
|
||||
+
|
||||
+ .comm __N__mod1,4,16
|
||||
diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.exp b/gdb/testsuite/gdb.fortran/xlf-variable.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/xlf-variable.exp
|
||||
@@ -0,0 +1,37 @@
|
||||
+# Copyright 2012 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 test can only be run on PPC64 machines.
|
||||
+
|
||||
+if { ![istarget powerpc64-*] || ![is_ilp32_target] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set testfile "xlf-variable"
|
||||
+set srcfile ${testfile}.S
|
||||
+
|
||||
+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "step" ".*y => z.*" "y => z"
|
||||
+gdb_test "step" ".*y = 3\.0.*" "y = 3.0"
|
||||
+gdb_test "step" ".*nullify \\(y\\).*" "nullify (y)"
|
||||
+gdb_test "print z" "= 3" "z = 3"
|
||||
+gdb_test "ptype z" "= REAL" "z is REAL"
|
||||
diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.f b/gdb/testsuite/gdb.fortran/xlf-variable.f
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.fortran/xlf-variable.f
|
||||
@@ -0,0 +1,33 @@
|
||||
+c Copyright 2012 Free Software Foundation, Inc.
|
||||
+c
|
||||
+c This program is free software; you can redistribute it and/or modify
|
||||
+c it under the terms of the GNU General Public License as published by
|
||||
+c the Free Software Foundation; either version 3 of the License, or
|
||||
+c (at your option) any later version.
|
||||
+c
|
||||
+c This program is distributed in the hope that it will be useful,
|
||||
+c but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+c GNU General Public License for more details.
|
||||
+c
|
||||
+c You should have received a copy of the GNU General Public License
|
||||
+c along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+c This file is the Fortran source file for xlf-variable.f.
|
||||
+c It was used to generate the assembly output called xlf-variable.S,
|
||||
+c which was generated using IBM's XLF compiler.
|
||||
+
|
||||
+ module mod1
|
||||
+ real, pointer :: y
|
||||
+ real, target :: z
|
||||
+ contains
|
||||
+ subroutine sub1
|
||||
+ y => z
|
||||
+ y = 3.0
|
||||
+ nullify (y)
|
||||
+ end subroutine
|
||||
+ end module
|
||||
+
|
||||
+ use mod1
|
||||
+ call sub1
|
||||
+ end
|
File diff suppressed because it is too large
Load Diff
162
gdb-simultaneous-step-resume-breakpoint-test.patch
Normal file
162
gdb-simultaneous-step-resume-breakpoint-test.patch
Normal file
@@ -0,0 +1,162 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-simultaneous-step-resume-breakpoint-test.patch
|
||||
|
||||
;; New test for step-resume breakpoint placed in multiple threads at once.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c
|
||||
@@ -0,0 +1,79 @@
|
||||
+/* Copyright 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+ Written by Fred Fish of Cygnus Support
|
||||
+ Contributed by Cygnus Support
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ 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/>. */
|
||||
+
|
||||
+/* Test multiple threads stepping into a .debug_line-less function with
|
||||
+ a breakpoint placed on its return-to-caller point. */
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <assert.h>
|
||||
+#include <unistd.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+#define THREADS 3
|
||||
+
|
||||
+static void *
|
||||
+func (void *unused)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ i = 0xdeadf00d;
|
||||
+ i = sleep (THREADS); /* sleep-call */
|
||||
+ if (errno != 0) /* sleep-after */
|
||||
+ perror ("sleep");
|
||||
+
|
||||
+ /* The GDB bug with forgotten step-resume breakpoint could leave stale
|
||||
+ breakpoint on the I assignment making it a nop. */
|
||||
+ if (i == 0xdeadf00d)
|
||||
+ assert (0);
|
||||
+
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ pthread_exit (NULL);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ pthread_t threads[THREADS];
|
||||
+ int threadi;
|
||||
+
|
||||
+ for (threadi = 0; threadi < THREADS; threadi++)
|
||||
+ {
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&threads[threadi], NULL, func, NULL);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ i = sleep (1);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+
|
||||
+ for (threadi = 0; threadi < THREADS; threadi++)
|
||||
+ {
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_join (threads[threadi], NULL);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+
|
||||
+ return 0; /* final-exit */
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp
|
||||
@@ -0,0 +1,65 @@
|
||||
+# Copyright (C) 2009 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/>. */
|
||||
+
|
||||
+# Test multiple threads stepping into a .debug_line-less function with
|
||||
+# a breakpoint placed on its return-to-caller point.
|
||||
+
|
||||
+set testfile simultaneous-step-resume-breakpoint
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+# Ensure we have no debuginfo for the `sleep' call itself (=for libc).
|
||||
+gdb_test "set debug-file-directory /DoesNotExist"
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Red Hat vendor patch does set it to "step" by default.
|
||||
+gdb_test "set scheduler-locking off"
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "final-exit"]
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "sleep-call"]
|
||||
+gdb_continue_to_breakpoint "sleep-call"
|
||||
+
|
||||
+gdb_test "step" "sleep-call.*" "step thread 1"
|
||||
+gdb_test "step" "sleep-call.*" "step thread 2"
|
||||
+gdb_test "step" "sleep-after.*" "step thread 3"
|
||||
+
|
||||
+set test "first continue"
|
||||
+gdb_test_multiple "continue" $test {
|
||||
+ -re "final-exit.*$gdb_prompt $" {
|
||||
+ # gdb-7.0.
|
||||
+ pass $test
|
||||
+ return
|
||||
+ }
|
||||
+ -re "sleep-after.*$gdb_prompt $" {
|
||||
+ # Fedora/RHEL branch.
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test "continue" "sleep-after.*" "second continue"
|
||||
+gdb_test "continue" "final-exit.*" "third continue"
|
45
gdb-support-rseq-auxvs.patch
Normal file
45
gdb-support-rseq-auxvs.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 1bbcd2144710c4b1daa9c404df0ebc80c3461747 Mon Sep 17 00:00:00 2001
|
||||
From: Ilya Leoshkevich <iii@linux.ibm.com>
|
||||
Date: Thu, 22 Jun 2023 01:03:04 +0200
|
||||
Subject: [PATCH 11/12] gdb: support rseq auxvs
|
||||
|
||||
Linux kernel commit commit 317c8194e6ae ("rseq: Introduce feature size
|
||||
and alignment ELF auxiliary vector entries") introduced two new auxvs:
|
||||
AT_RSEQ_FEATURE_SIZE and AT_RSEQ_ALIGN. Support them in GDB. This
|
||||
fixes auxv.exp on kernels >= v6.3.
|
||||
---
|
||||
gdb/auxv.c | 4 ++++
|
||||
include/elf/common.h | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/gdb/auxv.c b/gdb/auxv.c
|
||||
index 812b2807554..3ce5ccd3342 100644
|
||||
--- a/gdb/auxv.c
|
||||
+++ b/gdb/auxv.c
|
||||
@@ -493,6 +493,10 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
|
||||
AUXV_FORMAT_STR);
|
||||
TAG (AT_RANDOM, _("Address of 16 random bytes"), AUXV_FORMAT_HEX);
|
||||
TAG (AT_HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
|
||||
+ TAG (AT_RSEQ_FEATURE_SIZE, _("rseq supported feature size"),
|
||||
+ AUXV_FORMAT_HEX);
|
||||
+ TAG (AT_RSEQ_ALIGN, _("rseq allocation alignment"),
|
||||
+ AUXV_FORMAT_HEX);
|
||||
TAG (AT_EXECFN, _("File name of executable"), AUXV_FORMAT_STR);
|
||||
TAG (AT_SECURE, _("Boolean, was exec setuid-like?"), AUXV_FORMAT_DEC);
|
||||
TAG (AT_SYSINFO, _("Special system info/entry points"), AUXV_FORMAT_HEX);
|
||||
diff --git a/include/elf/common.h b/include/elf/common.h
|
||||
index 16587f6fb06..a37b1f9a264 100644
|
||||
--- a/include/elf/common.h
|
||||
+++ b/include/elf/common.h
|
||||
@@ -1353,6 +1353,8 @@
|
||||
may differ from AT_PLATFORM. */
|
||||
#define AT_RANDOM 25 /* Address of 16 random bytes. */
|
||||
#define AT_HWCAP2 26 /* Extension of AT_HWCAP. */
|
||||
+#define AT_RSEQ_FEATURE_SIZE 27 /* rseq supported feature size */
|
||||
+#define AT_RSEQ_ALIGN 28 /* rseq allocation alignment */
|
||||
#define AT_EXECFN 31 /* Filename of executable. */
|
||||
/* Pointer to the global system page used for system calls and other
|
||||
nice things. */
|
||||
--
|
||||
2.35.3
|
||||
|
299
gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch
Normal file
299
gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch
Normal file
@@ -0,0 +1,299 @@
|
||||
From 7f4601b0a51f400bd1b1bc0f7895254d467e3bb4 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Fri, 21 Jul 2023 08:25:25 +0200
|
||||
Subject: [PATCH] [gdb/symtab] Add optimized out static var to cooked index
|
||||
|
||||
Consider the test-case:
|
||||
...
|
||||
$ cat main.c
|
||||
int main (void) { return 0; }
|
||||
$ cat static-optimized-out.c
|
||||
static int aaa;
|
||||
...
|
||||
compiled like this:
|
||||
...
|
||||
$ gcc-12 static-optimized-out.c main.c -g -O2 -flto
|
||||
...
|
||||
|
||||
There's a difference in behaviour depending on symtab expansion state:
|
||||
...
|
||||
$ gdb -q -batch a.out -ex "print aaa"
|
||||
No symbol "aaa" in current context.
|
||||
$ gdb -q -batch a.out -ex "maint expand-symtab" -ex "print aaa"
|
||||
$1 = <optimized out>
|
||||
...
|
||||
|
||||
The reason for the difference is that the optimized out variable aaa:
|
||||
...
|
||||
<1><104>: Abbrev Number: 2 (DW_TAG_variable)
|
||||
<105> DW_AT_name : aaa
|
||||
<109> DW_AT_decl_file : 1
|
||||
<10a> DW_AT_decl_line : 18
|
||||
<10b> DW_AT_decl_column : 12
|
||||
<10c> DW_AT_type : <0x110>
|
||||
...
|
||||
is not added to the cooked index because of this clause in abbrev_table::read:
|
||||
...
|
||||
else if (!has_location && !has_specification_or_origin && !has_external
|
||||
&& cur_abbrev->tag == DW_TAG_variable)
|
||||
cur_abbrev->interesting = false;
|
||||
...
|
||||
|
||||
Fix this inconsistency by making sure that the optimized out variable is added
|
||||
to the cooked index.
|
||||
|
||||
Regression tested on x86_64-linux.
|
||||
|
||||
Add two test-cases, a C test-case gdb.opt/static-optimized-out.exp and a dwarf
|
||||
assembly test-case gdb.dwarf2/static-optimized-out.exp.
|
||||
|
||||
Tested gdb.opt/static-optimized-out.exp with gcc-8 to gcc-12, for which we now
|
||||
consistently get:
|
||||
...
|
||||
(gdb) print aaa^M
|
||||
$1 = <optimized out>^M
|
||||
...
|
||||
and with gcc 7.5.0 and clang 13.0.1, for which we still consistently get:
|
||||
...
|
||||
(gdb) print aaa^M
|
||||
No symbol "aaa" in current context.^M
|
||||
...
|
||||
due to missing debug info for the variable.
|
||||
|
||||
PR symtab/30656
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30656
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
---
|
||||
gdb/dwarf2/abbrev.c | 9 ---
|
||||
.../gdb.dwarf2/static-optimized-out.exp | 69 +++++++++++++++++++
|
||||
gdb/testsuite/gdb.opt/main.c | 22 ++++++
|
||||
gdb/testsuite/gdb.opt/static-optimized-out.c | 18 +++++
|
||||
.../gdb.opt/static-optimized-out.exp | 49 +++++++++++++
|
||||
5 files changed, 158 insertions(+), 9 deletions(-)
|
||||
create mode 100644 gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
|
||||
create mode 100644 gdb/testsuite/gdb.opt/main.c
|
||||
create mode 100644 gdb/testsuite/gdb.opt/static-optimized-out.c
|
||||
create mode 100644 gdb/testsuite/gdb.opt/static-optimized-out.exp
|
||||
|
||||
diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c
|
||||
index 1ebf8f6eed5..3a429fd41b1 100644
|
||||
--- a/gdb/dwarf2/abbrev.c
|
||||
+++ b/gdb/dwarf2/abbrev.c
|
||||
@@ -162,7 +162,6 @@ abbrev_table::read (struct dwarf2_section_info *section,
|
||||
bool has_specification_or_origin = false;
|
||||
bool has_name = false;
|
||||
bool has_linkage_name = false;
|
||||
- bool has_location = false;
|
||||
bool has_external = false;
|
||||
|
||||
/* Now read in declarations. */
|
||||
@@ -217,11 +216,6 @@ abbrev_table::read (struct dwarf2_section_info *section,
|
||||
has_linkage_name = true;
|
||||
break;
|
||||
|
||||
- case DW_AT_const_value:
|
||||
- case DW_AT_location:
|
||||
- has_location = true;
|
||||
- break;
|
||||
-
|
||||
case DW_AT_sibling:
|
||||
if (is_csize && cur_attr.form == DW_FORM_ref4)
|
||||
sibling_offset = size;
|
||||
@@ -296,9 +290,6 @@ abbrev_table::read (struct dwarf2_section_info *section,
|
||||
cur_abbrev->interesting = false;
|
||||
else if (!tag_interesting_for_index (cur_abbrev->tag))
|
||||
cur_abbrev->interesting = false;
|
||||
- else if (!has_location && !has_specification_or_origin && !has_external
|
||||
- && cur_abbrev->tag == DW_TAG_variable)
|
||||
- cur_abbrev->interesting = false;
|
||||
else
|
||||
cur_abbrev->interesting = true;
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
|
||||
new file mode 100644
|
||||
index 00000000000..1547a8acbc0
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp
|
||||
@@ -0,0 +1,69 @@
|
||||
+# Copyright 2023 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/>.
|
||||
+
|
||||
+# Check that an optimized out static variable is printed the same independent
|
||||
+# of state of symtab expansion. See also gdb.opt/static-optimized-out.exp.
|
||||
+
|
||||
+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 main.c -dw.S
|
||||
+
|
||||
+# Make DWARF for the test.
|
||||
+set asm_file [standard_output_file $srcfile2]
|
||||
+Dwarf::assemble $asm_file {
|
||||
+ cu {} {
|
||||
+ compile_unit {
|
||||
+ {
|
||||
+ language @DW_LANG_C
|
||||
+ }
|
||||
+ } {
|
||||
+ 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_variable {
|
||||
+ {name var}
|
||||
+ {type :$integer_label}
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" ${testfile} \
|
||||
+ [list $srcfile $asm_file] {nodebug}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "print var" " = <optimized out>"
|
||||
+
|
||||
+# Expand all symbol tables.
|
||||
+gdb_test_no_output "maint expand-symtabs"
|
||||
+
|
||||
+# Make sure we do an actual lookup rather than just returning the same as
|
||||
+# before.
|
||||
+gdb_test_no_output "maint flush symbol-cache"
|
||||
+
|
||||
+with_test_prefix "after expand-symtabs" {
|
||||
+ gdb_test "print var" " = <optimized out>"
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.opt/main.c b/gdb/testsuite/gdb.opt/main.c
|
||||
new file mode 100644
|
||||
index 00000000000..c6beff77dbe
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.opt/main.c
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2023 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/>. */
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.opt/static-optimized-out.c b/gdb/testsuite/gdb.opt/static-optimized-out.c
|
||||
new file mode 100644
|
||||
index 00000000000..44287fbd6d2
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.opt/static-optimized-out.c
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2023 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/>. */
|
||||
+
|
||||
+static int aaa;
|
||||
diff --git a/gdb/testsuite/gdb.opt/static-optimized-out.exp b/gdb/testsuite/gdb.opt/static-optimized-out.exp
|
||||
new file mode 100644
|
||||
index 00000000000..bd673b6503e
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.opt/static-optimized-out.exp
|
||||
@@ -0,0 +1,49 @@
|
||||
+# Copyright 2023 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/>.
|
||||
+
|
||||
+# Check that an optimized out static variable is printed the same independent
|
||||
+# of state of symtab expansion. See also gdb.dwarf2/static-optimized-out.exp.
|
||||
+
|
||||
+standard_testfile .c main.c
|
||||
+
|
||||
+set opts {}
|
||||
+lappend opts debug
|
||||
+lappend opts "optimize=-O2 -flto"
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" $testfile \
|
||||
+ [list $srcfile $srcfile2] $opts] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set val ""
|
||||
+gdb_test_multiple "print aaa" "" {
|
||||
+ -re -wrap "\r\n(?:\\$$decimal = )?(\[^\r\n\]*)" {
|
||||
+ set val $expect_out(1,string)
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { $val == "" } {
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Expand all symbol tables.
|
||||
+gdb_test_no_output "maint expand-symtab"
|
||||
+
|
||||
+# Make sure we do an actual lookup rather than just returning the same as
|
||||
+# before.
|
||||
+gdb_test_no_output "maint flush symbol-cache"
|
||||
+
|
||||
+# Now check that we get the same result in both cases.
|
||||
+gdb_test "print aaa" [string_to_regexp $val] "consistency"
|
||||
|
||||
base-commit: 800c393f89a94f49b01dff99f693cb13c5e28116
|
||||
--
|
||||
2.35.3
|
||||
|
125
gdb-symtab-add-producer_is_gas.patch
Normal file
125
gdb-symtab-add-producer_is_gas.patch
Normal file
@@ -0,0 +1,125 @@
|
||||
From aa8ba17b9a3fdfeeb65df4c3e0731a0e9e96cbf7 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Wed, 1 Nov 2023 00:33:12 +0100
|
||||
Subject: [PATCH 1/2] [gdb/symtab] Add producer_is_gas
|
||||
|
||||
Add producer_is_gas, a generic way to get the gas version from the
|
||||
producer string.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
---
|
||||
gdb/dwarf2/read.c | 4 ++--
|
||||
gdb/producer.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
gdb/producer.h | 5 +++++
|
||||
3 files changed, 63 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
index 970dd54c7a5..472684a5817 100644
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -13376,8 +13376,8 @@ check_producer (struct dwarf2_cu *cu)
|
||||
cu->producer_is_codewarrior = true;
|
||||
else if (producer_is_clang (cu->producer, &major, &minor))
|
||||
cu->producer_is_clang = true;
|
||||
- else if (startswith (cu->producer, "GNU AS 2.39.0"))
|
||||
- cu->producer_is_gas_2_39 = true;
|
||||
+ else if (producer_is_gas (cu->producer, &major, &minor))
|
||||
+ cu->producer_is_gas_2_39 = major == 2 && minor == 39;
|
||||
else
|
||||
{
|
||||
/* For other non-GCC compilers, expect their behavior is DWARF version
|
||||
diff --git a/gdb/producer.c b/gdb/producer.c
|
||||
index 9fcf749e3d4..cd83dfce128 100644
|
||||
--- a/gdb/producer.c
|
||||
+++ b/gdb/producer.c
|
||||
@@ -81,6 +81,45 @@ producer_is_gcc (const char *producer, int *major, int *minor)
|
||||
|
||||
/* See producer.h. */
|
||||
|
||||
+bool
|
||||
+producer_is_gas (const char *producer, int *major, int *minor)
|
||||
+{
|
||||
+ if (producer == nullptr)
|
||||
+ {
|
||||
+ /* No producer, don't know. */
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* Detect prefix. */
|
||||
+ const char prefix[] = "GNU AS ";
|
||||
+ if (!startswith (producer, prefix))
|
||||
+ {
|
||||
+ /* Producer is not gas. */
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* Skip prefix. */
|
||||
+ const char *cs = &producer[strlen (prefix)];
|
||||
+
|
||||
+ /* Ensure that major/minor are not nullptrs. */
|
||||
+ int maj, min;
|
||||
+ if (major == nullptr)
|
||||
+ major = &maj;
|
||||
+ if (minor == nullptr)
|
||||
+ minor = &min;
|
||||
+
|
||||
+ int scanned = sscanf (cs, "%d.%d", major, minor);
|
||||
+ if (scanned != 2)
|
||||
+ {
|
||||
+ /* Unable to scan major/minor version. */
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+ /* See producer.h. */
|
||||
+
|
||||
bool
|
||||
producer_is_icc_ge_19 (const char *producer)
|
||||
{
|
||||
@@ -251,6 +290,23 @@ Version 18.0 Beta";
|
||||
SELF_CHECK (!producer_is_gcc (flang_llvm_exp, &major, &minor));
|
||||
SELF_CHECK (producer_is_llvm (flang_llvm_exp));
|
||||
}
|
||||
+
|
||||
+ {
|
||||
+ static const char gas_exp[] = "GNU AS 2.39.0";
|
||||
+ int major = 0, minor = 0;
|
||||
+ SELF_CHECK (!producer_is_gcc (gas_exp, &major, &minor));
|
||||
+ SELF_CHECK (producer_is_gas (gas_exp, &major, &minor));
|
||||
+ SELF_CHECK (major == 2 && minor == 39);
|
||||
+
|
||||
+ static const char gas_incomplete_exp[] = "GNU AS ";
|
||||
+ SELF_CHECK (!producer_is_gas (gas_incomplete_exp, &major, &minor));
|
||||
+ SELF_CHECK (!producer_is_gcc (gas_incomplete_exp, &major, &minor));
|
||||
+
|
||||
+ static const char gas_incomplete_exp_2[] = "GNU AS 2";
|
||||
+ SELF_CHECK (!producer_is_gas (gas_incomplete_exp_2, &major, &minor));
|
||||
+ SELF_CHECK (!producer_is_gcc (gas_incomplete_exp_2, &major, &minor));
|
||||
+ }
|
||||
+
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/gdb/producer.h b/gdb/producer.h
|
||||
index c915979b122..00718511775 100644
|
||||
--- a/gdb/producer.h
|
||||
+++ b/gdb/producer.h
|
||||
@@ -30,6 +30,11 @@ extern int producer_is_gcc_ge_4 (const char *producer);
|
||||
is NULL or it isn't GCC. */
|
||||
extern int producer_is_gcc (const char *producer, int *major, int *minor);
|
||||
|
||||
+/* Returns nonzero if the given PRODUCER string is GAS and sets the MAJOR
|
||||
+ and MINOR versions when not NULL. Returns zero if the given PRODUCER
|
||||
+ is NULL or it isn't GAS. */
|
||||
+bool producer_is_gas (const char *producer, int *major, int *minor);
|
||||
+
|
||||
/* Check for Intel compilers >= 19.0. */
|
||||
extern bool producer_is_icc_ge_19 (const char *producer);
|
||||
|
||||
|
||||
base-commit: 39553c1e285c426946188ec2a890c1c1cb933060
|
||||
--
|
||||
2.35.3
|
||||
|
81
gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch
Normal file
81
gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch
Normal file
@@ -0,0 +1,81 @@
|
||||
From 04d0d6ebdc6d08f5a7ec0d4c89eb1835deef54dc Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Sun, 13 Aug 2023 14:08:06 +0200
|
||||
Subject: [PATCH] [gdb/symtab] Don't deduplicate variables in gdb-index
|
||||
|
||||
When running test-case gdb.python/py-symbol.exp with target board
|
||||
cc-with-gdb-index, we run into:
|
||||
...
|
||||
(gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M
|
||||
1^M
|
||||
(gdb) FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr')))
|
||||
...
|
||||
|
||||
[ Note that the test-case contains rr in both py-symtab.c:
|
||||
...
|
||||
static int __attribute__ ((used)) rr = 42; /* line of rr */
|
||||
...
|
||||
and py-symtab-2.c:
|
||||
...
|
||||
static int __attribute__ ((used)) rr = 99; /* line of other rr */
|
||||
... ]
|
||||
|
||||
This passes with gdb-12-branch, and fails with gdb-13-branch.
|
||||
|
||||
AFAIU the current code in symtab_index_entry::minimize makes the assumption
|
||||
that it's fine to store only one copy of rr in the gdb-index, because
|
||||
"print rr" will only ever print one, and always the same.
|
||||
|
||||
But that fails to recognize that gdb supports gdb.lookup_static_symbols, which
|
||||
returns a list of variables rather than the first one.
|
||||
|
||||
In other words, the current approach breaks feature parity between cooked
|
||||
index and gdb-index.
|
||||
|
||||
Note btw that also debug-names has both instances:
|
||||
...
|
||||
[ 5] #00597969 rr:
|
||||
<4> DW_TAG_variable DW_IDX_compile_unit=3 DW_IDX_GNU_internal=1
|
||||
<4> DW_TAG_variable DW_IDX_compile_unit=4 DW_IDX_GNU_internal=1
|
||||
...
|
||||
|
||||
Fix this in symtab_index_entry::minimize, by not deduplicating variables.
|
||||
|
||||
Tested on x86_64-linux, with target boards unix and cc-with-gdb-index.
|
||||
|
||||
Reviewed-by: Kevin Buettner <kevinb@redhat.com>
|
||||
|
||||
PR symtab/30720
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30720
|
||||
---
|
||||
gdb/dwarf2/index-write.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
|
||||
index d10583568c0..ea67f73ac3c 100644
|
||||
--- a/gdb/dwarf2/index-write.c
|
||||
+++ b/gdb/dwarf2/index-write.c
|
||||
@@ -294,7 +294,7 @@ symtab_index_entry::minimize ()
|
||||
auto from = std::unique (cu_indices.begin (), cu_indices.end ());
|
||||
cu_indices.erase (from, cu_indices.end ());
|
||||
|
||||
- /* We don't want to enter a variable or type more than once, so
|
||||
+ /* We don't want to enter a type more than once, so
|
||||
remove any such duplicates from the list as well. When doing
|
||||
this, we want to keep the entry from the first CU -- but this is
|
||||
implicit due to the sort. This choice is done because it's
|
||||
@@ -304,8 +304,7 @@ symtab_index_entry::minimize ()
|
||||
[&] (offset_type val)
|
||||
{
|
||||
gdb_index_symbol_kind kind = GDB_INDEX_SYMBOL_KIND_VALUE (val);
|
||||
- if (kind != GDB_INDEX_SYMBOL_KIND_TYPE
|
||||
- && kind != GDB_INDEX_SYMBOL_KIND_VARIABLE)
|
||||
+ if (kind != GDB_INDEX_SYMBOL_KIND_TYPE)
|
||||
return false;
|
||||
|
||||
val &= ~GDB_INDEX_CU_MASK;
|
||||
|
||||
base-commit: 2521ac7ed0c495b9e804c4356939b9be7166853c
|
||||
--
|
||||
2.35.3
|
||||
|
74
gdb-symtab-don-t-defer-backward-refs-inter-cu-intra-.patch
Normal file
74
gdb-symtab-don-t-defer-backward-refs-inter-cu-intra-.patch
Normal file
@@ -0,0 +1,74 @@
|
||||
From 6d472b241c96f181f88867860e92f1dfe7364903 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Sat, 16 Sep 2023 04:07:22 +0200
|
||||
Subject: [PATCH 08/11] [gdb/symtab] Don't defer backward refs, inter-cu
|
||||
intra-shard case
|
||||
|
||||
In patch "[gdb/symtab] Resolve deferred entries, inter-shard case" we've
|
||||
solved the generic case of handling deferred entries.
|
||||
|
||||
Add an optimization that doesn't defer inter-CU intra-shard dependencies that
|
||||
are present in the shard's parent map.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
---
|
||||
gdb/dwarf2/read.c | 29 ++++++++++++++++++++++++++++-
|
||||
1 file changed, 28 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
||||
index 0ab3e1a1500..d2d50b5c9cc 100644
|
||||
--- a/gdb/dwarf2/read.c
|
||||
+++ b/gdb/dwarf2/read.c
|
||||
@@ -6709,6 +6709,12 @@ class cooked_index_storage
|
||||
m_index->set_parent_valid (start, end);
|
||||
}
|
||||
|
||||
+ /* Return true if find_parents can be relied upon. */
|
||||
+ bool parent_valid (CORE_ADDR addr)
|
||||
+ {
|
||||
+ return m_index->parent_valid (addr);
|
||||
+ }
|
||||
+
|
||||
private:
|
||||
|
||||
/* Hash function for a cutu_reader. */
|
||||
@@ -6857,6 +6863,12 @@ class cooked_indexer
|
||||
{
|
||||
m_index_storage->set_parent_valid (start, end);
|
||||
}
|
||||
+
|
||||
+ /* Return true if find_parents can be relied upon. */
|
||||
+ bool parent_valid (CORE_ADDR addr)
|
||||
+ {
|
||||
+ return m_index_storage->parent_valid (addr);
|
||||
+ }
|
||||
};
|
||||
|
||||
/* Subroutine of dwarf2_build_psymtabs_hard to simplify it.
|
||||
@@ -18387,7 +18399,22 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
|
||||
else
|
||||
{
|
||||
/* Inter-CU case. */
|
||||
- *maybe_defer = addr;
|
||||
+ if (parent_valid (addr))
|
||||
+ {
|
||||
+ auto tmp = find_parent (addr);
|
||||
+ if (tmp == &parent_map::deferred)
|
||||
+ {
|
||||
+ /* Defer because origin is deferred. */
|
||||
+ *maybe_defer = addr;
|
||||
+ }
|
||||
+ else
|
||||
+ *parent_entry = tmp;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Defer because origin is in other shard. */
|
||||
+ *maybe_defer = addr;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.35.3
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user