Sync from SUSE:SLFO:Main gdb revision 2fe8218ba81a6662b6bfb745dc698c31
This commit is contained in:
parent
3930d7f403
commit
8eb1fded12
@ -1,50 +0,0 @@
|
||||
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,202 +0,0 @@
|
||||
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
|
||||
|
53
change-gdb.base-examine-backwards.exp-for-aix.patch
Normal file
53
change-gdb.base-examine-backwards.exp-for-aix.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From acc7b542a08819bec4aae767de547c531a7ab62e Mon Sep 17 00:00:00 2001
|
||||
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
|
||||
Date: Mon, 6 Nov 2023 07:26:24 -0600
|
||||
Subject: [PATCH 03/48] Change gdb.base/examine-backwards.exp for AIX.
|
||||
|
||||
In AIX unused or constant variables are collected as garbage by the linker and in the dwarf dump
|
||||
an address with all f's in hexadecimal are assigned. Hence the testcase fails with many failures stating
|
||||
it cannot access memory.
|
||||
|
||||
This patch is a small change to get it working in AIX as well.
|
||||
---
|
||||
gdb/testsuite/gdb.base/examine-backward.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/examine-backward.c b/gdb/testsuite/gdb.base/examine-backward.c
|
||||
index e30b58fb005..354c2e2f323 100644
|
||||
--- a/gdb/testsuite/gdb.base/examine-backward.c
|
||||
+++ b/gdb/testsuite/gdb.base/examine-backward.c
|
||||
@@ -36,11 +36,11 @@ literals. The content of each array is the same as followings:
|
||||
TestStrings, to avoid showing garbage when we look for strings
|
||||
backwards from TestStrings. */
|
||||
|
||||
-const unsigned char Barrier[] = {
|
||||
+unsigned char Barrier[] = {
|
||||
0x00,
|
||||
};
|
||||
|
||||
-const unsigned char TestStrings[] = {
|
||||
+unsigned char TestStrings[] = {
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
|
||||
0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
|
||||
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
@@ -54,7 +54,7 @@ const unsigned char TestStrings[] = {
|
||||
0x00
|
||||
};
|
||||
|
||||
-const short TestStringsH[] = {
|
||||
+short TestStringsH[] = {
|
||||
0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048,
|
||||
0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050,
|
||||
0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058,
|
||||
@@ -67,7 +67,7 @@ const short TestStringsH[] = {
|
||||
0x0000
|
||||
};
|
||||
|
||||
-const int TestStringsW[] = {
|
||||
+int TestStringsW[] = {
|
||||
0x00000041, 0x00000042, 0x00000043, 0x00000044,
|
||||
0x00000045, 0x00000046, 0x00000047, 0x00000048,
|
||||
0x00000049, 0x0000004a, 0x0000004b, 0x0000004c,
|
||||
--
|
||||
2.35.3
|
||||
|
@ -1,148 +0,0 @@
|
||||
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
|
||||
|
366
fix-regression-on-aarch64-linux-gdbserver.patch
Normal file
366
fix-regression-on-aarch64-linux-gdbserver.patch
Normal file
@ -0,0 +1,366 @@
|
||||
From 2a7e48ca27f4c080151ce9da5a29239aa5d3b66f Mon Sep 17 00:00:00 2001
|
||||
From: Tom Tromey <tromey@adacore.com>
|
||||
Date: Fri, 19 Apr 2024 07:54:19 -0600
|
||||
Subject: [PATCH 15/48] Fix regression on aarch64-linux gdbserver
|
||||
|
||||
Commit 9a03f218 ("Fix gdb.base/watchpoint-unaligned.exp on aarch64")
|
||||
fixed a watchpoint bug in gdb -- but did not touch the corresponding
|
||||
code in gdbserver.
|
||||
|
||||
This patch moves the gdb code into gdb/nat, so that it can be shared
|
||||
with gdbserver, and then changes gdbserver to use it, fixing the bug.
|
||||
|
||||
This is yet another case where having a single back end would prevent
|
||||
bugs.
|
||||
|
||||
I tested this using the AdaCore internal gdb testsuite.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29423
|
||||
Approved-By: Luis Machado <luis.machado@arm.com>
|
||||
---
|
||||
gdb/aarch64-nat.c | 115 ---------------------------------
|
||||
gdb/aarch64-nat.h | 8 ---
|
||||
gdb/nat/aarch64-hw-point.c | 115 +++++++++++++++++++++++++++++++++
|
||||
gdb/nat/aarch64-hw-point.h | 8 +++
|
||||
gdbserver/linux-aarch64-low.cc | 38 +----------
|
||||
5 files changed, 126 insertions(+), 158 deletions(-)
|
||||
|
||||
diff --git a/gdb/aarch64-nat.c b/gdb/aarch64-nat.c
|
||||
index a173e4e18d5..97e3048568a 100644
|
||||
--- a/gdb/aarch64-nat.c
|
||||
+++ b/gdb/aarch64-nat.c
|
||||
@@ -225,121 +225,6 @@ aarch64_remove_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
|
||||
return ret;
|
||||
}
|
||||
|
||||
-/* See aarch64-nat.h. */
|
||||
-
|
||||
-bool
|
||||
-aarch64_stopped_data_address (const struct aarch64_debug_reg_state *state,
|
||||
- CORE_ADDR addr_trap, CORE_ADDR *addr_p)
|
||||
-{
|
||||
- bool found = false;
|
||||
- for (int phase = 0; phase <= 1; ++phase)
|
||||
- for (int i = aarch64_num_wp_regs - 1; i >= 0; --i)
|
||||
- {
|
||||
- if (!(state->dr_ref_count_wp[i]
|
||||
- && DR_CONTROL_ENABLED (state->dr_ctrl_wp[i])))
|
||||
- {
|
||||
- /* Watchpoint disabled. */
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- const enum target_hw_bp_type type
|
||||
- = aarch64_watchpoint_type (state->dr_ctrl_wp[i]);
|
||||
- if (type == hw_execute)
|
||||
- {
|
||||
- /* Watchpoint disabled. */
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- if (phase == 0)
|
||||
- {
|
||||
- /* Phase 0: No hw_write. */
|
||||
- if (type == hw_write)
|
||||
- continue;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /* Phase 1: Only hw_write. */
|
||||
- if (type != hw_write)
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- const unsigned int offset
|
||||
- = aarch64_watchpoint_offset (state->dr_ctrl_wp[i]);
|
||||
- const unsigned int len
|
||||
- = aarch64_watchpoint_length (state->dr_ctrl_wp[i]);
|
||||
- const CORE_ADDR addr_watch = state->dr_addr_wp[i] + offset;
|
||||
- const CORE_ADDR addr_watch_aligned
|
||||
- = align_down (state->dr_addr_wp[i], AARCH64_HWP_MAX_LEN_PER_REG);
|
||||
- const CORE_ADDR addr_orig = state->dr_addr_orig_wp[i];
|
||||
-
|
||||
- /* ADDR_TRAP reports the first address of the memory range
|
||||
- accessed by the CPU, regardless of what was the memory
|
||||
- range watched. Thus, a large CPU access that straddles
|
||||
- the ADDR_WATCH..ADDR_WATCH+LEN range may result in an
|
||||
- ADDR_TRAP that is lower than the
|
||||
- ADDR_WATCH..ADDR_WATCH+LEN range. E.g.:
|
||||
-
|
||||
- addr: | 4 | 5 | 6 | 7 | 8 |
|
||||
- |---- range watched ----|
|
||||
- |----------- range accessed ------------|
|
||||
-
|
||||
- In this case, ADDR_TRAP will be 4.
|
||||
-
|
||||
- The access size also can be larger than that of the watchpoint
|
||||
- itself. For instance, the access size of an stp instruction is 16.
|
||||
- So, if we use stp to store to address p, and set a watchpoint on
|
||||
- address p + 8, the reported ADDR_TRAP can be p + 8 (observed on
|
||||
- RK3399 SOC). But it also can be p (observed on M1 SOC). Checking
|
||||
- for this situation introduces the possibility of false positives,
|
||||
- so we only do this for hw_write watchpoints. */
|
||||
- const CORE_ADDR max_access_size = type == hw_write ? 16 : 8;
|
||||
- const CORE_ADDR addr_watch_base = addr_watch_aligned -
|
||||
- (max_access_size - AARCH64_HWP_MAX_LEN_PER_REG);
|
||||
- if (!(addr_trap >= addr_watch_base
|
||||
- && addr_trap < addr_watch + len))
|
||||
- {
|
||||
- /* Not a match. */
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- /* To match a watchpoint known to GDB core, we must never
|
||||
- report *ADDR_P outside of any ADDR_WATCH..ADDR_WATCH+LEN
|
||||
- range. ADDR_WATCH <= ADDR_TRAP < ADDR_ORIG is a false
|
||||
- positive on kernels older than 4.10. See PR
|
||||
- external/20207. */
|
||||
- if (addr_p != nullptr)
|
||||
- *addr_p = addr_orig;
|
||||
-
|
||||
- if (phase == 0)
|
||||
- {
|
||||
- /* Phase 0: Return first match. */
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- /* Phase 1. */
|
||||
- if (addr_p == nullptr)
|
||||
- {
|
||||
- /* First match, and we don't need to report an address. No need
|
||||
- to look for other matches. */
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- if (!found)
|
||||
- {
|
||||
- /* First match, and we need to report an address. Look for other
|
||||
- matches. */
|
||||
- found = true;
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- /* More than one match, and we need to return an address. No need to
|
||||
- look for further matches. */
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- return found;
|
||||
-}
|
||||
-
|
||||
/* Define AArch64 maintenance commands. */
|
||||
|
||||
static void
|
||||
diff --git a/gdb/aarch64-nat.h b/gdb/aarch64-nat.h
|
||||
index fee6bda2577..f95a9d745e5 100644
|
||||
--- a/gdb/aarch64-nat.h
|
||||
+++ b/gdb/aarch64-nat.h
|
||||
@@ -45,14 +45,6 @@ struct aarch64_debug_reg_state *aarch64_get_debug_reg_state (pid_t pid);
|
||||
|
||||
void aarch64_remove_debug_reg_state (pid_t pid);
|
||||
|
||||
-/* Helper for the "stopped_data_address" target method. Returns TRUE
|
||||
- if a hardware watchpoint trap at ADDR_TRAP matches a set
|
||||
- watchpoint. The address of the matched watchpoint is returned in
|
||||
- *ADDR_P. */
|
||||
-
|
||||
-bool aarch64_stopped_data_address (const struct aarch64_debug_reg_state *state,
|
||||
- CORE_ADDR addr_trap, CORE_ADDR *addr_p);
|
||||
-
|
||||
/* Helper functions used by aarch64_nat_target below. See their
|
||||
definitions. */
|
||||
|
||||
diff --git a/gdb/nat/aarch64-hw-point.c b/gdb/nat/aarch64-hw-point.c
|
||||
index 3b8cdcba23b..9eb78923e86 100644
|
||||
--- a/gdb/nat/aarch64-hw-point.c
|
||||
+++ b/gdb/nat/aarch64-hw-point.c
|
||||
@@ -647,3 +647,118 @@ aarch64_region_ok_for_watchpoint (CORE_ADDR addr, int len)
|
||||
the checking is costly. */
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+/* See nat/aarch64-hw-point.h. */
|
||||
+
|
||||
+bool
|
||||
+aarch64_stopped_data_address (const struct aarch64_debug_reg_state *state,
|
||||
+ CORE_ADDR addr_trap, CORE_ADDR *addr_p)
|
||||
+{
|
||||
+ bool found = false;
|
||||
+ for (int phase = 0; phase <= 1; ++phase)
|
||||
+ for (int i = aarch64_num_wp_regs - 1; i >= 0; --i)
|
||||
+ {
|
||||
+ if (!(state->dr_ref_count_wp[i]
|
||||
+ && DR_CONTROL_ENABLED (state->dr_ctrl_wp[i])))
|
||||
+ {
|
||||
+ /* Watchpoint disabled. */
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ const enum target_hw_bp_type type
|
||||
+ = aarch64_watchpoint_type (state->dr_ctrl_wp[i]);
|
||||
+ if (type == hw_execute)
|
||||
+ {
|
||||
+ /* Watchpoint disabled. */
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (phase == 0)
|
||||
+ {
|
||||
+ /* Phase 0: No hw_write. */
|
||||
+ if (type == hw_write)
|
||||
+ continue;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Phase 1: Only hw_write. */
|
||||
+ if (type != hw_write)
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ const unsigned int offset
|
||||
+ = aarch64_watchpoint_offset (state->dr_ctrl_wp[i]);
|
||||
+ const unsigned int len
|
||||
+ = aarch64_watchpoint_length (state->dr_ctrl_wp[i]);
|
||||
+ const CORE_ADDR addr_watch = state->dr_addr_wp[i] + offset;
|
||||
+ const CORE_ADDR addr_watch_aligned
|
||||
+ = align_down (state->dr_addr_wp[i], AARCH64_HWP_MAX_LEN_PER_REG);
|
||||
+ const CORE_ADDR addr_orig = state->dr_addr_orig_wp[i];
|
||||
+
|
||||
+ /* ADDR_TRAP reports the first address of the memory range
|
||||
+ accessed by the CPU, regardless of what was the memory
|
||||
+ range watched. Thus, a large CPU access that straddles
|
||||
+ the ADDR_WATCH..ADDR_WATCH+LEN range may result in an
|
||||
+ ADDR_TRAP that is lower than the
|
||||
+ ADDR_WATCH..ADDR_WATCH+LEN range. E.g.:
|
||||
+
|
||||
+ addr: | 4 | 5 | 6 | 7 | 8 |
|
||||
+ |---- range watched ----|
|
||||
+ |----------- range accessed ------------|
|
||||
+
|
||||
+ In this case, ADDR_TRAP will be 4.
|
||||
+
|
||||
+ The access size also can be larger than that of the watchpoint
|
||||
+ itself. For instance, the access size of an stp instruction is 16.
|
||||
+ So, if we use stp to store to address p, and set a watchpoint on
|
||||
+ address p + 8, the reported ADDR_TRAP can be p + 8 (observed on
|
||||
+ RK3399 SOC). But it also can be p (observed on M1 SOC). Checking
|
||||
+ for this situation introduces the possibility of false positives,
|
||||
+ so we only do this for hw_write watchpoints. */
|
||||
+ const CORE_ADDR max_access_size = type == hw_write ? 16 : 8;
|
||||
+ const CORE_ADDR addr_watch_base = addr_watch_aligned -
|
||||
+ (max_access_size - AARCH64_HWP_MAX_LEN_PER_REG);
|
||||
+ if (!(addr_trap >= addr_watch_base
|
||||
+ && addr_trap < addr_watch + len))
|
||||
+ {
|
||||
+ /* Not a match. */
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* To match a watchpoint known to GDB core, we must never
|
||||
+ report *ADDR_P outside of any ADDR_WATCH..ADDR_WATCH+LEN
|
||||
+ range. ADDR_WATCH <= ADDR_TRAP < ADDR_ORIG is a false
|
||||
+ positive on kernels older than 4.10. See PR
|
||||
+ external/20207. */
|
||||
+ if (addr_p != nullptr)
|
||||
+ *addr_p = addr_orig;
|
||||
+
|
||||
+ if (phase == 0)
|
||||
+ {
|
||||
+ /* Phase 0: Return first match. */
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ /* Phase 1. */
|
||||
+ if (addr_p == nullptr)
|
||||
+ {
|
||||
+ /* First match, and we don't need to report an address. No need
|
||||
+ to look for other matches. */
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (!found)
|
||||
+ {
|
||||
+ /* First match, and we need to report an address. Look for other
|
||||
+ matches. */
|
||||
+ found = true;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* More than one match, and we need to return an address. No need to
|
||||
+ look for further matches. */
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return found;
|
||||
+}
|
||||
diff --git a/gdb/nat/aarch64-hw-point.h b/gdb/nat/aarch64-hw-point.h
|
||||
index 71ae2864927..2386cf60f90 100644
|
||||
--- a/gdb/nat/aarch64-hw-point.h
|
||||
+++ b/gdb/nat/aarch64-hw-point.h
|
||||
@@ -110,6 +110,14 @@ unsigned int aarch64_watchpoint_offset (unsigned int ctrl);
|
||||
unsigned int aarch64_watchpoint_length (unsigned int ctrl);
|
||||
enum target_hw_bp_type aarch64_watchpoint_type (unsigned int ctrl);
|
||||
|
||||
+/* Helper for the "stopped_data_address" target method. Returns TRUE
|
||||
+ if a hardware watchpoint trap at ADDR_TRAP matches a set
|
||||
+ watchpoint. The address of the matched watchpoint is returned in
|
||||
+ *ADDR_P. */
|
||||
+
|
||||
+bool aarch64_stopped_data_address (const struct aarch64_debug_reg_state *state,
|
||||
+ CORE_ADDR addr_trap, CORE_ADDR *addr_p);
|
||||
+
|
||||
int aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr,
|
||||
int len, int is_insert, ptid_t ptid,
|
||||
struct aarch64_debug_reg_state *state);
|
||||
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
|
||||
index fcbe7bb64d7..14346b89822 100644
|
||||
--- a/gdbserver/linux-aarch64-low.cc
|
||||
+++ b/gdbserver/linux-aarch64-low.cc
|
||||
@@ -577,41 +577,9 @@ aarch64_target::low_stopped_data_address ()
|
||||
|
||||
/* Check if the address matches any watched address. */
|
||||
state = aarch64_get_debug_reg_state (pid_of (current_thread));
|
||||
- for (i = aarch64_num_wp_regs - 1; i >= 0; --i)
|
||||
- {
|
||||
- const unsigned int offset
|
||||
- = aarch64_watchpoint_offset (state->dr_ctrl_wp[i]);
|
||||
- const unsigned int len = aarch64_watchpoint_length (state->dr_ctrl_wp[i]);
|
||||
- const CORE_ADDR addr_watch = state->dr_addr_wp[i] + offset;
|
||||
- const CORE_ADDR addr_watch_aligned = align_down (state->dr_addr_wp[i], 8);
|
||||
- const CORE_ADDR addr_orig = state->dr_addr_orig_wp[i];
|
||||
-
|
||||
- if (state->dr_ref_count_wp[i]
|
||||
- && DR_CONTROL_ENABLED (state->dr_ctrl_wp[i])
|
||||
- && addr_trap >= addr_watch_aligned
|
||||
- && addr_trap < addr_watch + len)
|
||||
- {
|
||||
- /* ADDR_TRAP reports the first address of the memory range
|
||||
- accessed by the CPU, regardless of what was the memory
|
||||
- range watched. Thus, a large CPU access that straddles
|
||||
- the ADDR_WATCH..ADDR_WATCH+LEN range may result in an
|
||||
- ADDR_TRAP that is lower than the
|
||||
- ADDR_WATCH..ADDR_WATCH+LEN range. E.g.:
|
||||
-
|
||||
- addr: | 4 | 5 | 6 | 7 | 8 |
|
||||
- |---- range watched ----|
|
||||
- |----------- range accessed ------------|
|
||||
-
|
||||
- In this case, ADDR_TRAP will be 4.
|
||||
-
|
||||
- To match a watchpoint known to GDB core, we must never
|
||||
- report *ADDR_P outside of any ADDR_WATCH..ADDR_WATCH+LEN
|
||||
- range. ADDR_WATCH <= ADDR_TRAP < ADDR_ORIG is a false
|
||||
- positive on kernels older than 4.10. See PR
|
||||
- external/20207. */
|
||||
- return addr_orig;
|
||||
- }
|
||||
- }
|
||||
+ CORE_ADDR result;
|
||||
+ if (aarch64_stopped_data_address (state, addr_trap, &result))
|
||||
+ return result;
|
||||
|
||||
return (CORE_ADDR) 0;
|
||||
}
|
||||
--
|
||||
2.35.3
|
||||
|
80
fix-the-gdb.ada-inline-section-gc.exp-test.patch
Normal file
80
fix-the-gdb.ada-inline-section-gc.exp-test.patch
Normal file
@ -0,0 +1,80 @@
|
||||
From c21fd9f7d5911fce0c17af7094d8861d1195dfda Mon Sep 17 00:00:00 2001
|
||||
From: Carl Love <cel@linux.ibm.com>
|
||||
Date: Mon, 13 Nov 2023 14:14:08 -0500
|
||||
Subject: [PATCH 01/48] Fix the gdb.ada/inline-section-gc.exp test
|
||||
|
||||
The original intention of the test appears to be checking to make sure
|
||||
setting a breakpoint in an inlined function didn't set multiple
|
||||
breakpoints where one of them was at address 0.
|
||||
|
||||
The gdb.ada/inline-section-gc.exp test may pass or fail depending on the
|
||||
version of gnat. Per the discussion on IRC, the ada inlining appears to
|
||||
have some target dependencies. In this test there are two functions,
|
||||
callee and caller. Function calee is inlined into caller. The test sets
|
||||
a breakpoint in function callee. The reported location where the
|
||||
breakpoint is set may be at the requested location in callee or the
|
||||
location in caller after callee has been inlined. The test needs to
|
||||
accept either location as correct provided the breakpoint address is not
|
||||
zero.
|
||||
|
||||
This patch checks to see if the reported breakpoint is in function callee
|
||||
or function caller and fails if the breakpoint address is 0x0. The line
|
||||
number where the breakpoint is set will match the requested line if the
|
||||
breakpoint location is reported is callee.adb. If the breakpoint is
|
||||
reported in caller.adb, the line number in caller is the breakpoint
|
||||
location in callee where it is inlined into caller.
|
||||
|
||||
This patch fixes the single regression failure for the test on PowerPC.
|
||||
It does not introduce any failures on X86-64.
|
||||
---
|
||||
gdb/testsuite/gdb.ada/inline-section-gc.exp | 21 ++++++++++++++++---
|
||||
.../gdb.ada/inline-section-gc/caller.adb | 3 ++-
|
||||
2 files changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.ada/inline-section-gc.exp b/gdb/testsuite/gdb.ada/inline-section-gc.exp
|
||||
index b707335eb04..4f8b8c95395 100644
|
||||
--- a/gdb/testsuite/gdb.ada/inline-section-gc.exp
|
||||
+++ b/gdb/testsuite/gdb.ada/inline-section-gc.exp
|
||||
@@ -34,8 +34,23 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $options] != ""} {
|
||||
|
||||
clean_restart ${testfile}
|
||||
|
||||
-set bp_location [gdb_get_line_number "BREAK" ${testdir}/callee.adb]
|
||||
+
|
||||
+# Depending on the version of gnat, the location of the set breakpoint may
|
||||
+# be reported as being at the requested location in file callee.adb or in
|
||||
+# file caller.adb where the callee function was inlined. Either way, only
|
||||
+# one breakpoint should be reported and its address should not be at 0x0.
|
||||
+set bp_location1 [gdb_get_line_number "BREAK" ${testdir}/callee.adb]
|
||||
+set bp_location2 [gdb_get_line_number "CALLEE_LOC" ${testdir}/caller.adb]
|
||||
+set test "break callee.adb:$bp_location1"
|
||||
+set message "Breakpoint set"
|
||||
+
|
||||
# The bug here was that gdb would set a breakpoint with two locations,
|
||||
# one of them at 0x0.
|
||||
-gdb_test "break callee.adb:$bp_location" \
|
||||
- "Breakpoint $decimal at $hex: file .*callee.adb, line $bp_location."
|
||||
+gdb_test_multiple $test $message {
|
||||
+ -re "Breakpoint $decimal at $hex: file .*callee.adb, line $bp_location1." {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Breakpoint $decimal at $hex: file .*caller.adb, line $bp_location2." {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.ada/inline-section-gc/caller.adb b/gdb/testsuite/gdb.ada/inline-section-gc/caller.adb
|
||||
index 66eb2d9a910..161f3e85542 100644
|
||||
--- a/gdb/testsuite/gdb.ada/inline-section-gc/caller.adb
|
||||
+++ b/gdb/testsuite/gdb.ada/inline-section-gc/caller.adb
|
||||
@@ -18,4 +18,5 @@ with Callee;
|
||||
procedure Caller is
|
||||
begin
|
||||
Callee;
|
||||
-end Caller;
|
||||
+end Caller; -- CALLEE_LOC, this is where the inlined callee breakpoint
|
||||
+ -- is located.
|
||||
|
||||
base-commit: 582fc35843fdf71b82d645d83d2903e2546cc21a
|
||||
--
|
||||
2.35.3
|
||||
|
@ -1,29 +0,0 @@
|
||||
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.*"
|
@ -1,26 +0,0 @@
|
||||
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
|
||||
|
@ -1,10 +1,19 @@
|
||||
From af4a87e2b3c2ac5acae1e6f4405fc59e1218de74 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Thu, 18 Apr 2024 14:26:58 +0200
|
||||
Subject: [PATCH] fixup-gdb-linux_perf-bundle
|
||||
|
||||
---
|
||||
gdb/gdb.c | 8 --------
|
||||
1 file changed, 8 deletions(-)
|
||||
|
||||
diff --git a/gdb/gdb.c b/gdb/gdb.c
|
||||
index 82e9e6da210..b5e28445630 100644
|
||||
index 41a9b70c222..6e3ff0755ab 100644
|
||||
--- a/gdb/gdb.c
|
||||
+++ b/gdb/gdb.c
|
||||
@@ -20,19 +20,11 @@
|
||||
#include "main.h"
|
||||
@@ -21,10 +21,6 @@
|
||||
#include "interps.h"
|
||||
#include "run-on-main-thread.h"
|
||||
|
||||
-#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
-extern "C" void __libipt_init(void);
|
||||
@ -13,6 +22,8 @@ index 82e9e6da210..b5e28445630 100644
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -36,10 +32,6 @@ main (int argc, char **argv)
|
||||
|
||||
struct captured_main_args args;
|
||||
|
||||
-#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
|
||||
@ -22,3 +33,8 @@ index 82e9e6da210..b5e28445630 100644
|
||||
memset (&args, 0, sizeof args);
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
|
||||
base-commit: 254988c36fe592e89af5d92e1d35a6eb4b09cbb0
|
||||
--
|
||||
2.35.3
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
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"
|
70
fixup-powerpc-and-aarch64-fix-reverse-stepping-failu.patch
Normal file
70
fixup-powerpc-and-aarch64-fix-reverse-stepping-failu.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From d60b57fe1a98094a7e4f19481193b2b5a9bb1e57 Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Thu, 2 May 2024 12:02:50 +0200
|
||||
Subject: [PATCH 079/147] fixup PowerPC and aarch64: Fix reverse stepping
|
||||
failure
|
||||
|
||||
---
|
||||
gdb/infrun.c | 2 +-
|
||||
gdb/symtab.c | 3 +--
|
||||
gdb/symtab.h | 3 +--
|
||||
3 files changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
index 069ef144a76..7be98cfc252 100644
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -6897,7 +6897,7 @@ update_line_range_start (CORE_ADDR pc, struct execution_control_state *ecs)
|
||||
Given the PC, check the line table and return the PC that corresponds
|
||||
to the line table entry for the source line that PC is in. */
|
||||
CORE_ADDR start_line_pc = ecs->event_thread->control.step_range_start;
|
||||
- std::optional<CORE_ADDR> real_range_start;
|
||||
+ gdb::optional<CORE_ADDR> real_range_start;
|
||||
|
||||
/* Call find_line_range_start to get the smallest address in the
|
||||
linetable for multiple Line X entries in the line table. */
|
||||
diff --git a/gdb/symtab.c b/gdb/symtab.c
|
||||
index ef63ec93c5a..9a47796e5e0 100644
|
||||
--- a/gdb/symtab.c
|
||||
+++ b/gdb/symtab.c
|
||||
@@ -73,7 +73,6 @@
|
||||
#include "gdbsupport/gdb_string_view.h"
|
||||
#include "gdbsupport/pathstuff.h"
|
||||
#include "gdbsupport/common-utils.h"
|
||||
-#include <optional>
|
||||
|
||||
/* Forward declarations for local functions. */
|
||||
|
||||
@@ -3328,7 +3327,7 @@ sal_line_symtab_matches_p (const symtab_and_line &sal1,
|
||||
|
||||
/* See symtah.h. */
|
||||
|
||||
-std::optional<CORE_ADDR>
|
||||
+gdb::optional<CORE_ADDR>
|
||||
find_line_range_start (CORE_ADDR pc)
|
||||
{
|
||||
struct symtab_and_line current_sal = find_pc_line (pc, 0);
|
||||
diff --git a/gdb/symtab.h b/gdb/symtab.h
|
||||
index e17d15c595b..6a611d42880 100644
|
||||
--- a/gdb/symtab.h
|
||||
+++ b/gdb/symtab.h
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "gdb-demangle.h"
|
||||
#include "split-name.h"
|
||||
#include "frame.h"
|
||||
-#include <optional>
|
||||
|
||||
/* Opaque declarations. */
|
||||
struct ui_file;
|
||||
@@ -2377,7 +2376,7 @@ extern struct symtab_and_line find_pc_sect_line (CORE_ADDR,
|
||||
the starting PC of line X, and the ranges are contiguous.
|
||||
*/
|
||||
|
||||
-extern std::optional<CORE_ADDR> find_line_range_start (CORE_ADDR pc);
|
||||
+extern gdb::optional<CORE_ADDR> find_line_range_start (CORE_ADDR pc);
|
||||
|
||||
/* Wrapper around find_pc_line to just return the symtab. */
|
||||
|
||||
--
|
||||
2.35.3
|
||||
|
101
fixup-skip-tests.patch
Normal file
101
fixup-skip-tests.patch
Normal file
@ -0,0 +1,101 @@
|
||||
From c1da0d6449415cc1fe6f863526735e4325b0b3ac Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Wed, 1 May 2024 12:43:41 +0200
|
||||
Subject: [PATCH 1/2] fixup-skip-tests
|
||||
|
||||
---
|
||||
gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp | 4 +---
|
||||
gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp | 4 +---
|
||||
gdb/testsuite/gdb.cp/cxxexec.exp | 2 +-
|
||||
.../py-gdb-rhbz1007614-memleak-infpy_read_memory.exp | 4 ++--
|
||||
gdb/testsuite/gdb.python/rh634108-solib_address.exp | 6 +++---
|
||||
5 files changed, 8 insertions(+), 12 deletions(-)
|
||||
|
||||
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
|
||||
index 0c46489f315..5879319f27c 100644
|
||||
--- a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
|
||||
@@ -13,9 +13,7 @@
|
||||
# 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
|
||||
-}
|
||||
+require allow_shlib_tests
|
||||
|
||||
set testfile "gcore-buildid-exec-but-not-solib"
|
||||
set srcmainfile ${testfile}-main.c
|
||||
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
index 052bd84d420..73a9bb64903 100644
|
||||
--- a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
|
||||
@@ -17,9 +17,7 @@
|
||||
# invalid IFUNC DW_AT_linkage_name: memmove strstr time
|
||||
# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
|
||||
|
||||
-if {[skip_shlib_tests]} {
|
||||
- return 0
|
||||
-}
|
||||
+require allow_shlib_tests
|
||||
|
||||
set testfile "gnu-ifunc-strstr-workaround"
|
||||
set executable ${testfile}
|
||||
diff --git a/gdb/testsuite/gdb.cp/cxxexec.exp b/gdb/testsuite/gdb.cp/cxxexec.exp
|
||||
index 77c85587407..089a679a1a9 100644
|
||||
--- a/gdb/testsuite/gdb.cp/cxxexec.exp
|
||||
+++ b/gdb/testsuite/gdb.cp/cxxexec.exp
|
||||
@@ -13,7 +13,7 @@
|
||||
# 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 }
|
||||
+require allow_cplus_tests
|
||||
|
||||
set testfile cxxexec
|
||||
if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
|
||||
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
|
||||
index 2e6786d499a..d2693cfef1d 100644
|
||||
--- 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
|
||||
@@ -13,6 +13,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
+require allow_python_tests
|
||||
+
|
||||
set testfile py-gdb-rhbz1007614-memleak-infpy_read_memory
|
||||
set srcfile ${testfile}.c
|
||||
set binfile [standard_output_file ${testfile}]
|
||||
@@ -21,8 +23,6 @@ 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 {} {
|
||||
diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
index ebf00babc34..2d950b79951 100644
|
||||
--- a/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=634108
|
||||
|
||||
+# Skip all tests if Python scripting is not enabled.
|
||||
+require allow_python_tests
|
||||
+
|
||||
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(0))" "None" "gdb.solib_name exists"
|
||||
|
||||
base-commit: 50ee7556c2430effed45ca542852f36368336dce
|
||||
--
|
||||
2.35.3
|
||||
|
BIN
gdb-13.2.tar.bz2
(Stored with Git LFS)
BIN
gdb-13.2.tar.bz2
(Stored with Git LFS)
Binary file not shown.
BIN
gdb-14.2.tar.bz2
(Stored with Git LFS)
Normal file
BIN
gdb-14.2.tar.bz2
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,109 +0,0 @@
|
||||
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"
|
||||
+ }
|
||||
+}
|
@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch
|
||||
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
|
||||
@@ -2035,7 +2035,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
|
||||
install: all
|
||||
@$(MAKE) $(FLAGS_TO_PASS) install-only
|
||||
|
||||
@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
||||
transformed_name=`t='$(program_transform_name)'; \
|
||||
echo gdb | sed -e "$$t"` ; \
|
||||
if test "x$$transformed_name" = x; then \
|
||||
@@ -2061,7 +2061,25 @@ install-guile:
|
||||
@@ -2085,7 +2085,25 @@ install-guile:
|
||||
install-python:
|
||||
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
|
||||
|
||||
@ -52,7 +52,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
||||
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)
|
||||
@@ -2116,6 +2134,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
||||
rm -f $(DESTDIR)$(bindir)/$$transformed_name
|
||||
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
|
||||
|
||||
|
@ -1,134 +0,0 @@
|
||||
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;
|
@ -44,7 +44,7 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
|
||||
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,
|
||||
@@ -1308,6 +1308,11 @@ process_print_command_args (const char *args, value_print_options *print_opts,
|
||||
|
||||
if (exp != nullptr && *exp)
|
||||
{
|
||||
@ -52,9 +52,10 @@ diff --git a/gdb/printcmd.c b/gdb/printcmd.c
|
||||
+ 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);
|
||||
+
|
||||
/* This setting allows large arrays to be printed by limiting the
|
||||
number of elements that are loaded into GDB's memory; we only
|
||||
need to load as many array elements as we plan to print. */
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
|
@ -1,135 +0,0 @@
|
||||
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
|
||||
+ }
|
||||
+}
|