aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/elfxx-riscv.c3
-rw-r--r--bfd/version.h2
-rw-r--r--binutils/objcopy.c4
-rw-r--r--gas/config/tc-aarch64.c41
-rw-r--r--gas/testsuite/gas/aarch64/rcpc3-fail.l44
-rw-r--r--gas/testsuite/gas/aarch64/rcpc3-fail.s5
-rw-r--r--gas/testsuite/gas/aarch64/rcpc3.d4
-rw-r--r--gas/testsuite/gas/aarch64/rcpc3.s4
-rw-r--r--gdb/cli/cli-style.c4
-rw-r--r--gdb/dwarf2/attribute.h4
-rw-r--r--gdb/dwarf2/die.c4
-rw-r--r--gdb/dwarf2/die.h12
-rw-r--r--gdb/dwarf2/read.c248
-rw-r--r--gdb/gcore-1.in4
-rw-r--r--gdb/linux-thread-db.c3
-rw-r--r--gdb/main.c6
-rw-r--r--gdb/python/python-internal.h2
-rw-r--r--gdb/source-cache.c28
-rw-r--r--gdb/source-cache.h2
-rw-r--r--gdb/testsuite/gdb.python/py-source-styling.exp107
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory.cpp12
-rw-r--r--gdb/testsuite/gdb.rocm/precise-memory.exp38
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c2
-rw-r--r--gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp4
-rw-r--r--gdb/testsuite/lib/rocm.exp19
-rw-r--r--gdb/utils.c6
-rw-r--r--gdbsupport/common-inferior.h2
-rw-r--r--ld/testsuite/ld-x86-64/pr19636-3d.d10
28 files changed, 301 insertions, 323 deletions
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 481bac9..92e024b 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1266,6 +1266,8 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
{"smstateen", "+ssstateen", check_implicit_always},
{"smepmp", "+zicsr", check_implicit_always},
{"smdbltrp", "+zicsr", check_implicit_always},
+ {"smnpm", "+zicsr", check_implicit_always},
+ {"smmpm", "+zicsr", check_implicit_always},
{"ssaia", "+zicsr", check_implicit_always},
{"sscsrind", "+zicsr", check_implicit_always},
@@ -1278,6 +1280,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
{"sstvecd", "+zicsr", check_implicit_always},
{"ssu64xl", "+zicsr", check_implicit_always},
{"ssdbltrp", "+zicsr", check_implicit_always},
+ {"ssnpm", "+zicsr", check_implicit_always},
{"svade", "+zicsr", check_implicit_always},
{"svadu", "+zicsr", check_implicit_always},
diff --git a/bfd/version.h b/bfd/version.h
index a6afff6..bacc797 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -16,7 +16,7 @@
In releases, the date is not included in either version strings or
sonames. */
-#define BFD_VERSION_DATE 20250319
+#define BFD_VERSION_DATE 20250322
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index e2e6bd7..572f22c 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2832,7 +2832,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
if (pe_file_alignment != (bfd_vma) -1)
pe->pe_opthdr.FileAlignment = pe_file_alignment;
- else
+ else if (!is_strip)
pe_file_alignment = PE_DEF_FILE_ALIGNMENT;
if (pe_heap_commit != (bfd_vma) -1)
@@ -2846,7 +2846,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
if (pe_section_alignment != (bfd_vma) -1)
pe->pe_opthdr.SectionAlignment = pe_section_alignment;
- else
+ else if (!is_strip)
pe_section_alignment = PE_DEF_SECTION_ALIGNMENT;
if (pe_stack_commit != (bfd_vma) -1)
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 840cf8c..e071ad1 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -8465,6 +8465,7 @@ warn_unpredictable_ldst (aarch64_instruction *instr, char *str)
case ldst_imm10:
case ldst_unscaled:
case ldst_unpriv:
+ ldst_single:
/* Loading/storing the base register is unpredictable if writeback. */
if ((aarch64_get_operand_class (opnds[0].type)
== AARCH64_OPND_CLASS_INT_REG)
@@ -8477,43 +8478,9 @@ warn_unpredictable_ldst (aarch64_instruction *instr, char *str)
break;
case rcpc3:
- {
- const int nb_operands = aarch64_num_of_operands (opcode);
- if (aarch64_get_operand_class (opnds[0].type)
- == AARCH64_OPND_CLASS_INT_REG)
- {
- /* Load Pair transfer with register overlap. */
- if (nb_operands == 3 && opnds[0].reg.regno == opnds[1].reg.regno)
- { // ldiapp, stilp
- as_warn (_("unpredictable load pair transfer with register "
- "overlap -- `%s'"),
- str);
- }
- /* Loading/storing the base register is unpredictable if writeback. */
- else if ((nb_operands == 2
- && opnds[0].reg.regno == opnds[1].addr.base_regno
- && opnds[1].addr.base_regno != REG_SP
- && opnds[1].addr.writeback)
- || (nb_operands == 3
- && (opnds[0].reg.regno == opnds[2].addr.base_regno
- || opnds[1].reg.regno == opnds[2].addr.base_regno)
- && opnds[2].addr.base_regno != REG_SP
- && opnds[2].addr.writeback))
- {
- if (strcmp (opcode->name, "ldapr") == 0
- || strcmp (opcode->name, "ldiapp") == 0)
- as_warn (
- _("unpredictable transfer with writeback (load) -- `%s'"),
- str);
- else // stlr, stilp
- as_warn (
- _("unpredictable transfer with writeback (store) -- `%s'"),
- str);
- }
- }
- }
- break;
-
+ if (aarch64_num_of_operands (opcode) == 2)
+ goto ldst_single;
+ /* Fall through. */
case ldstpair_off:
case ldstnapair_offs:
case ldstpair_indexed:
diff --git a/gas/testsuite/gas/aarch64/rcpc3-fail.l b/gas/testsuite/gas/aarch64/rcpc3-fail.l
index 96c2f0a..95987fe 100644
--- a/gas/testsuite/gas/aarch64/rcpc3-fail.l
+++ b/gas/testsuite/gas/aarch64/rcpc3-fail.l
@@ -51,27 +51,23 @@
.*: Error: invalid increment amount at operand 2 -- `stlr x0,\[x1,#-4\]!'
.*: Error: invalid increment amount at operand 2 -- `stlr w0,\[x1,#4\]!'
.*: Error: invalid increment amount at operand 2 -- `stlr x0,\[x1,#8\]!'
-.*: Warning: unpredictable load pair transfer with register overlap -- `ldiapp w0,w0,\[x1\]'
-.*: Warning: unpredictable load pair transfer with register overlap -- `ldiapp x0,x0,\[x1\]'
-.*: Warning: unpredictable load pair transfer with register overlap -- `ldiapp w0,w0,\[x1\],#8'
-.*: Warning: unpredictable load pair transfer with register overlap -- `ldiapp x0,x0,\[x1\],#16'
-.*: Warning: unpredictable load pair transfer with register overlap -- `stilp w0,w0,\[x1\]'
-.*: Warning: unpredictable load pair transfer with register overlap -- `stilp x0,x0,\[x1\]'
-.*: Warning: unpredictable load pair transfer with register overlap -- `stilp w0,w0,\[x1,#-8\]!'
-.*: Warning: unpredictable load pair transfer with register overlap -- `stilp x0,x0,\[x1,#-16\]!'
-.*: Warning: unpredictable transfer with writeback \(load\) -- `ldiapp x0,x1,\[x0\],#16'
-.*: Warning: unpredictable transfer with writeback \(load\) -- `ldiapp x0,x1,\[x1\],#16'
-.*: Warning: unpredictable transfer with writeback \(load\) -- `ldiapp w0,w1,\[x0\],#8'
-.*: Warning: unpredictable transfer with writeback \(load\) -- `ldiapp w0,w1,\[x1\],#8'
-.*: Warning: unpredictable transfer with writeback \(load\) -- `ldapr x0,\[x0\],#8'
-.*: Warning: unpredictable transfer with writeback \(load\) -- `ldapr w0,\[x0\],#4'
-.*: Warning: unpredictable transfer with writeback \(load\) -- `ldapr x1,\[x1\],#8'
-.*: Warning: unpredictable transfer with writeback \(load\) -- `ldapr x30,\[x30\],#8'
-.*: Warning: unpredictable transfer with writeback \(store\) -- `stilp x0,x1,\[x1,#-16\]!'
-.*: Warning: unpredictable transfer with writeback \(store\) -- `stilp w0,w1,\[x1,#-8\]!'
-.*: Warning: unpredictable transfer with writeback \(store\) -- `stilp x0,x1,\[x0,#-16\]!'
-.*: Warning: unpredictable transfer with writeback \(store\) -- `stilp w0,w1,\[x0,#-8\]!'
-.*: Warning: unpredictable transfer with writeback \(store\) -- `stlr x0,\[x0,#-8\]!'
-.*: Warning: unpredictable transfer with writeback \(store\) -- `stlr w0,\[x0,#-4\]!'
-.*: Warning: unpredictable transfer with writeback \(store\) -- `stlr x1,\[x1,#-8\]!'
-.*: Warning: unpredictable transfer with writeback \(store\) -- `stlr x30,\[x30,#-8\]!' \ No newline at end of file
+.*: Warning: unpredictable load of register pair -- `ldiapp w0,w0,\[x1\]'
+.*: Warning: unpredictable load of register pair -- `ldiapp x0,x0,\[x1\]'
+.*: Warning: unpredictable load of register pair -- `ldiapp w0,w0,\[x1\],#8'
+.*: Warning: unpredictable load of register pair -- `ldiapp x0,x0,\[x1\],#16'
+.*: Warning: unpredictable transfer with writeback -- `ldiapp x0,x1,\[x0\],#16'
+.*: Warning: unpredictable transfer with writeback -- `ldiapp x0,x1,\[x1\],#16'
+.*: Warning: unpredictable transfer with writeback -- `ldiapp w0,w1,\[x0\],#8'
+.*: Warning: unpredictable transfer with writeback -- `ldiapp w0,w1,\[x1\],#8'
+.*: Warning: unpredictable transfer with writeback -- `ldapr x0,\[x0\],#8'
+.*: Warning: unpredictable transfer with writeback -- `ldapr w0,\[x0\],#4'
+.*: Warning: unpredictable transfer with writeback -- `ldapr x1,\[x1\],#8'
+.*: Warning: unpredictable transfer with writeback -- `ldapr x30,\[x30\],#8'
+.*: Warning: unpredictable transfer with writeback -- `stilp x0,x1,\[x1,#-16\]!'
+.*: Warning: unpredictable transfer with writeback -- `stilp w0,w1,\[x1,#-8\]!'
+.*: Warning: unpredictable transfer with writeback -- `stilp x0,x1,\[x0,#-16\]!'
+.*: Warning: unpredictable transfer with writeback -- `stilp w0,w1,\[x0,#-8\]!'
+.*: Warning: unpredictable transfer with writeback -- `stlr x0,\[x0,#-8\]!'
+.*: Warning: unpredictable transfer with writeback -- `stlr w0,\[x0,#-4\]!'
+.*: Warning: unpredictable transfer with writeback -- `stlr x1,\[x1,#-8\]!'
+.*: Warning: unpredictable transfer with writeback -- `stlr x30,\[x30,#-8\]!'
diff --git a/gas/testsuite/gas/aarch64/rcpc3-fail.s b/gas/testsuite/gas/aarch64/rcpc3-fail.s
index 687bdd7..1dfdd97 100644
--- a/gas/testsuite/gas/aarch64/rcpc3-fail.s
+++ b/gas/testsuite/gas/aarch64/rcpc3-fail.s
@@ -81,11 +81,6 @@
ldiapp w0, w0, [x1], #8
ldiapp x0, x0, [x1], #16
- stilp w0, w0, [x1]
- stilp x0, x0, [x1]
- stilp w0, w0, [x1, #-8]!
- stilp x0, x0, [x1, #-16]!
-
/* Invalid write back overlap (load)*/
ldiapp x0, x1, [x0], #16
ldiapp x0, x1, [x1], #16
diff --git a/gas/testsuite/gas/aarch64/rcpc3.d b/gas/testsuite/gas/aarch64/rcpc3.d
index 575e46e..36c36a3 100644
--- a/gas/testsuite/gas/aarch64/rcpc3.d
+++ b/gas/testsuite/gas/aarch64/rcpc3.d
@@ -28,8 +28,10 @@ Disassembly of section \.text:
[^:]+: 99010860 stilp w0, w1, \[x3, #-8\]!
[^:]+: d9011820 stilp x0, x1, \[x1\]
[^:]+: d9011800 stilp x0, x1, \[x0\]
+[^:]+: d9001800 stilp x0, x0, \[x0\]
[^:]+: 99011820 stilp w0, w1, \[x1\]
[^:]+: 99011800 stilp w0, w1, \[x0\]
+[^:]+: 99001800 stilp w0, w0, \[x0\]
[^:]+: b8bfc020 ldapr w0, \[x1\]
[^:]+: b8bfc020 ldapr w0, \[x1\]
[^:]+: f8bfc020 ldapr x0, \[x1\]
@@ -44,8 +46,10 @@ Disassembly of section \.text:
[^:]+: d9c00be0 ldapr x0, \[sp\], #8
[^:]+: 889ffc20 stlr w0, \[x1\]
[^:]+: 889ffc20 stlr w0, \[x1\]
+[^:]+: 889ffc00 stlr w0, \[x0\]
[^:]+: c89ffc20 stlr x0, \[x1\]
[^:]+: c89ffc20 stlr x0, \[x1\]
+[^:]+: c89ffc00 stlr x0, \[x0\]
[^:]+: 99800841 stlr w1, \[x2, #-4\]!
[^:]+: d9800841 stlr x1, \[x2, #-8\]!
[^:]+: d980081e stlr x30, \[x0, #-8\]!
diff --git a/gas/testsuite/gas/aarch64/rcpc3.s b/gas/testsuite/gas/aarch64/rcpc3.s
index 41026d4..b3e4055 100644
--- a/gas/testsuite/gas/aarch64/rcpc3.s
+++ b/gas/testsuite/gas/aarch64/rcpc3.s
@@ -29,8 +29,10 @@
// for store is fine.
stilp x0, x1, [x1]
stilp x0, x1, [x0]
+ stilp x0, x0, [x0]
stilp w0, w1, [x1]
stilp w0, w1, [x0]
+ stilp w0, w0, [x0]
ldapr w0, [x1]
ldapr w0, [x1, #0]
@@ -47,8 +49,10 @@
stlr w0, [x1]
stlr w0, [x1, #0]
+ stlr w0, [x0]
stlr x0, [x1]
stlr x0, [x1, #0]
+ stlr x0, [x0]
stlr w1, [x2, #-4]!
stlr x1, [x2, #-8]!
stlr x30, [x0, #-8]!
diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c
index b436275..5484245 100644
--- a/gdb/cli/cli-style.c
+++ b/gdb/cli/cli-style.c
@@ -372,7 +372,9 @@ set_style_enabled (const char *args, int from_tty, struct cmd_list_element *c)
warning ("The current terminal doesn't support styling. Styled output "
"might not appear as expected.");
- g_source_cache.clear ();
+ /* It is not necessary to flush the source cache here. The source cache
+ tracks whether entries are styled or not. */
+
gdb::observers::styling_changed.notify ();
}
diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h
index 4dce04d..ce6c563 100644
--- a/gdb/dwarf2/attribute.h
+++ b/gdb/dwarf2/attribute.h
@@ -105,8 +105,8 @@ struct attribute
/* Return an unsigned constant value. This only handles constant
forms (i.e., form_is_constant -- and not the extended list of
"unsigned" forms) and assumes an unsigned value is desired. This
- can intended for use with DWARF-defined enumerations like DW_CC_*
- or DW_INL_*, but also in situations where a nonnegative constant
+ can be used with DWARF-defined enumerations like DW_CC_* or
+ DW_INL_*, but also in situations where a nonnegative constant
integer is specified by DWARF.
If a signed form and negative value is used, or if a non-constant
diff --git a/gdb/dwarf2/die.c b/gdb/dwarf2/die.c
index 500d7bf..9437c2f 100644
--- a/gdb/dwarf2/die.c
+++ b/gdb/dwarf2/die.c
@@ -184,9 +184,9 @@ dump_die_1 (struct ui_file *f, int level, int max_level, struct die_info *die)
}
}
- if (die->sibling != NULL && level > 0)
+ if (die->next != NULL && level > 0)
{
- dump_die_1 (f, level, max_level, die->sibling);
+ dump_die_1 (f, level, max_level, die->next);
}
}
diff --git a/gdb/dwarf2/die.h b/gdb/dwarf2/die.h
index 770964e..cffb5cb 100644
--- a/gdb/dwarf2/die.h
+++ b/gdb/dwarf2/die.h
@@ -22,6 +22,7 @@
#include "complaints.h"
#include "dwarf2/attribute.h"
+#include "gdbsupport/next-iterator.h"
/* This data structure holds a complete die structure. */
struct die_info
@@ -103,6 +104,13 @@ struct die_info
return 0;
}
+ /* Return a range suitable for iterating over the children of this
+ DIE. */
+ next_range<die_info> children () const
+ {
+ return next_range<die_info> (child);
+ }
+
/* DWARF-2 tag for this DIE. */
ENUM_BITFIELD(dwarf_tag) tag : 16;
@@ -128,9 +136,9 @@ struct die_info
/* The dies in a compilation unit form an n-ary tree. PARENT
points to this die's parent; CHILD points to the first child of
this node; and all the children of a given node are chained
- together via their SIBLING fields. */
+ together via their NEXT fields. */
struct die_info *child; /* Its first child, if any. */
- struct die_info *sibling; /* Its next sibling, if any. */
+ struct die_info *next; /* Its next sibling, if any. */
struct die_info *parent; /* Its parent, if any. */
/* An array of attributes, with NUM_ATTRS elements. There may be
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b9040a5..8875e97 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5456,12 +5456,11 @@ dwarf2_compute_name (const char *name,
if (lang == language_cplus && strchr (name, '<') == NULL)
{
struct attribute *attr;
- struct die_info *child;
int first = 1;
die->building_fullname = 1;
- for (child = die->child; child != NULL; child = child->sibling)
+ for (die_info *child : die->children ())
{
struct type *type;
LONGEST value;
@@ -5825,7 +5824,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->per_objfile->objfile;
struct attribute *import_attr;
- struct die_info *imported_die, *child_die;
+ struct die_info *imported_die;
struct dwarf2_cu *imported_cu;
const char *imported_name;
const char *imported_name_prefix;
@@ -5908,10 +5907,8 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
else
canonical_name = imported_name;
- if (die->tag == DW_TAG_imported_module
- && cu->lang () == language_fortran)
- for (child_die = die->child; child_die && child_die->tag;
- child_die = child_die->sibling)
+ if (die->tag == DW_TAG_imported_module && cu->lang () == language_fortran)
+ for (die_info *child_die : die->children ())
{
/* DWARF-4: A Fortran use statement with a “rename list” may be
represented by an imported module entry with an import attribute
@@ -6098,7 +6095,6 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
struct objfile *objfile = per_objfile->objfile;
CORE_ADDR lowpc;
struct attribute *attr;
- struct die_info *child_die;
unrelocated_addr unrel_low, unrel_high;
get_scope_pc_bounds (die, &unrel_low, &unrel_high, cu);
@@ -6145,15 +6141,9 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
handle_DW_AT_stmt_list (die, cu, fnd, unrel_low, unrel_low != unrel_high);
/* Process all dies in compilation unit. */
- if (die->child != NULL)
- {
- child_die = die->child;
- while (child_die && child_die->tag)
- {
- process_die (child_die, cu);
- child_die = child_die->sibling;
- }
- }
+ for (die_info *child_die : die->children ())
+ process_die (child_die, cu);
+
per_objfile->sym_cu = nullptr;
/* Decode macro information, if present. Dwarf 2 macro information
@@ -6309,22 +6299,13 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
static void
read_type_unit_scope (struct die_info *die, struct dwarf2_cu *cu)
{
- struct die_info *child_die;
-
/* Initialize (or reinitialize) the machinery for building symtabs.
We do this before processing child DIEs, so that the line header table
is available for DW_AT_decl_file. */
cu->setup_type_unit_groups (die);
- if (die->child != NULL)
- {
- child_die = die->child;
- while (child_die && child_die->tag)
- {
- process_die (child_die, cu);
- child_die = child_die->sibling;
- }
- }
+ for (die_info *child_die : die->children ())
+ process_die (child_die, cu);
}
/* DWO/DWP files.
@@ -8210,8 +8191,8 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
break;
}
- concrete_child = concrete_child->sibling;
- abstract_child = abstract_child->sibling;
+ concrete_child = concrete_child->next;
+ abstract_child = abstract_child->next;
}
/* Walk the origin's children in parallel to the concrete children.
@@ -8224,9 +8205,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
std::vector<sect_offset> offsets;
- for (die_info *child_die = die->child;
- child_die && child_die->tag;
- child_die = child_die->sibling)
+ for (die_info *child_die : die->children ())
{
/* We are trying to process concrete instance entries:
DW_TAG_call_site DIEs indeed have a DW_AT_abstract_origin tag, but
@@ -8238,7 +8217,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
{
if (are_isomorphic)
corresponding_abstract_child
- = corresponding_abstract_child->sibling;
+ = corresponding_abstract_child->next;
continue;
}
@@ -8296,7 +8275,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
}
if (are_isomorphic)
- corresponding_abstract_child = corresponding_abstract_child->sibling;
+ corresponding_abstract_child = corresponding_abstract_child->next;
}
if (!offsets.empty ())
@@ -8314,8 +8293,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
}
auto offsets_it = offsets.begin ();
- die_info *origin_child_die = origin_die->child;
- while (origin_child_die != nullptr && origin_child_die->tag != 0)
+ for (die_info *origin_child_die : origin_die->children ())
{
/* Is ORIGIN_CHILD_DIE referenced by any of the DIE children? */
while (offsets_it < offsets.end ()
@@ -8332,8 +8310,6 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
if (!origin_child_die->in_process)
process_die (origin_child_die, origin_cu);
}
-
- origin_child_die = origin_child_die->sibling;
}
origin_cu->list_in_scope = origin_previous_list_in_scope;
@@ -8424,7 +8400,6 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
struct context_stack *newobj;
CORE_ADDR lowpc;
CORE_ADDR highpc;
- struct die_info *child_die;
struct attribute *attr, *call_line, *call_file;
const char *name;
struct block *block;
@@ -8501,7 +8476,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
/* If we have any template arguments, then we must allocate a
different sort of symbol. */
- for (child_die = die->child; child_die; child_die = child_die->sibling)
+ for (die_info *child_die : die->children ())
{
if (child_die->tag == DW_TAG_template_type_param
|| child_die->tag == DW_TAG_template_value_param)
@@ -8539,23 +8514,18 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
cu->list_in_scope = cu->get_builder ()->get_local_symbols ();
- if (die->child != NULL)
+ for (die_info *child_die : die->children ())
{
- child_die = die->child;
- while (child_die && child_die->tag)
+ if (child_die->tag == DW_TAG_template_type_param
+ || child_die->tag == DW_TAG_template_value_param)
{
- if (child_die->tag == DW_TAG_template_type_param
- || child_die->tag == DW_TAG_template_value_param)
- {
- struct symbol *arg = new_symbol (child_die, NULL, cu);
+ struct symbol *arg = new_symbol (child_die, NULL, cu);
- if (arg != NULL)
- template_args.push_back (arg);
- }
- else
- process_die (child_die, cu);
- child_die = child_die->sibling;
+ if (arg != NULL)
+ template_args.push_back (arg);
}
+ else
+ process_die (child_die, cu);
}
inherit_abstract_dies (die, cu);
@@ -8571,13 +8541,9 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
while (spec_die)
{
- child_die = spec_die->child;
- while (child_die && child_die->tag)
- {
- if (child_die->tag == DW_TAG_imported_module)
- process_die (child_die, spec_cu);
- child_die = child_die->sibling;
- }
+ for (die_info *child_die : spec_die->children ())
+ if (child_die->tag == DW_TAG_imported_module)
+ process_die (child_die, spec_cu);
/* In some cases, GCC generates specification DIEs that
themselves contain DW_AT_specification attributes. */
@@ -8646,7 +8612,6 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
CORE_ADDR lowpc, highpc;
- struct die_info *child_die;
/* Ignore blocks with missing or invalid low and high pc attributes. */
/* ??? Perhaps consider discontiguous blocks defined by DW_AT_ranges
@@ -8661,9 +8626,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
/* DW_TAG_lexical_block has no attributes, process its children as if
there was no wrapping by that DW_TAG_lexical_block.
GCC does no longer produces such DWARF since GCC r224161. */
- for (child_die = die->child;
- child_die != NULL && child_die->tag;
- child_die = child_die->sibling)
+ for (die_info *child_die : die->children ())
{
/* We might already be processing this DIE. This can happen
in an unusual circumstance -- where a subroutine A
@@ -8682,15 +8645,9 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
highpc = per_objfile->relocate (unrel_high);
cu->get_builder ()->push_context (0, lowpc);
- if (die->child != NULL)
- {
- child_die = die->child;
- while (child_die && child_die->tag)
- {
- process_die (child_die, cu);
- child_die = child_die->sibling;
- }
- }
+ for (die_info *child_die : die->children ())
+ process_die (child_die, cu);
+
inherit_abstract_dies (die, cu);
struct context_stack cstk = cu->get_builder ()->pop_context ();
@@ -8733,7 +8690,6 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
struct gdbarch *gdbarch = objfile->arch ();
struct attribute *attr;
int nparams;
- struct die_info *child_die;
attr = dwarf2_attr (die, DW_AT_call_return_pc, cu);
if (attr == NULL)
@@ -8754,8 +8710,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
/* Count parameters at the caller. */
nparams = 0;
- for (child_die = die->child; child_die && child_die->tag;
- child_die = child_die->sibling)
+ for (die_info *child_die : die->children ())
{
if (child_die->tag != DW_TAG_call_site_parameter
&& child_die->tag != DW_TAG_GNU_call_site_parameter)
@@ -8924,9 +8879,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
"block nor reference, for DIE %s [in module %s]"),
sect_offset_str (die->sect_off), objfile_name (objfile));
- for (child_die = die->child;
- child_die && child_die->tag;
- child_die = child_die->sibling)
+ for (die_info *child_die : die->children ())
{
struct call_site_parameter *parameter;
struct attribute *loc, *origin;
@@ -9646,7 +9599,6 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
struct dwarf2_cu *cu)
{
unrelocated_addr low, high;
- struct die_info *child = die->child;
if (dwarf2_get_pc_bounds (die, &low, &high, cu, nullptr, nullptr)
>= PC_BOUNDS_RANGES)
@@ -9664,12 +9616,11 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
subprograms, then check their pc bounds. Likewise, we need to
check lexical blocks as well, as they may also contain subprogram
definitions. */
- while (child && child->tag)
+ for (die_info *child : die->children ())
{
if (child->tag == DW_TAG_subprogram
|| child->tag == DW_TAG_lexical_block)
dwarf2_get_subprogram_pc_bounds (child, lowpc, highpc, cu);
- child = child->sibling;
}
}
@@ -9695,9 +9646,7 @@ get_scope_pc_bounds (struct die_info *die,
}
else
{
- struct die_info *child = die->child;
-
- while (child && child->tag)
+ for (die_info *child : die->children ())
{
switch (child->tag) {
case DW_TAG_subprogram:
@@ -9725,8 +9674,6 @@ get_scope_pc_bounds (struct die_info *die,
/* Ignore. */
break;
}
-
- child = child->sibling;
}
}
@@ -11277,9 +11224,7 @@ handle_variant_part (struct die_info *die, struct type *type,
objfile_name (cu->per_objfile->objfile));
}
- for (die_info *child_die = die->child;
- child_die != NULL;
- child_die = child_die->sibling)
+ for (die_info *child_die : die->children ())
handle_struct_member_die (child_die, type, fi, template_args, cu);
}
@@ -11330,9 +11275,7 @@ handle_variant (struct die_info *die, struct type *type,
else
variant.discriminant_value = discr->constant_value (0);
- for (die_info *variant_child = die->child;
- variant_child != NULL;
- variant_child = variant_child->sibling)
+ for (die_info *variant_child : die->children ())
handle_struct_member_die (variant_child, type, fi, template_args, cu);
variant.last_field = fi->fields.size ();
@@ -11401,7 +11344,6 @@ static void
process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->per_objfile->objfile;
- struct die_info *child_die;
struct type *type;
type = get_die_type (die, cu);
@@ -11414,13 +11356,8 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
struct field_info fi;
std::vector<struct symbol *> template_args;
- child_die = die->child;
-
- while (child_die && child_die->tag)
- {
- handle_struct_member_die (child_die, type, &fi, &template_args, cu);
- child_die = child_die->sibling;
- }
+ for (die_info *child_die : die->children ())
+ handle_struct_member_die (child_die, type, &fi, &template_args, cu);
/* Attach template arguments to type. */
if (!template_args.empty ())
@@ -11558,9 +11495,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
current die is a declaration. Normally, of course, a declaration
won't have any children at all. */
- child_die = die->child;
-
- while (child_die != NULL && child_die->tag)
+ for (die_info *child_die : die->children ())
{
if (child_die->tag == DW_TAG_member
|| child_die->tag == DW_TAG_variable
@@ -11572,8 +11507,6 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
}
else
process_die (child_die, cu);
-
- child_die = child_die->sibling;
}
/* Do not consider external references. According to the DWARF standard,
@@ -11673,16 +11606,13 @@ update_enumeration_type_from_children (struct die_info *die,
struct type *type,
struct dwarf2_cu *cu)
{
- struct die_info *child_die;
int unsigned_enum = 1;
int flag_enum = 1;
auto_obstack obstack;
std::vector<struct field> fields;
- for (child_die = die->child;
- child_die != NULL && child_die->tag;
- child_die = child_die->sibling)
+ for (die_info *child_die : die->children ())
{
struct attribute *attr;
LONGEST value;
@@ -11840,10 +11770,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
if (die->child != NULL)
{
- struct die_info *child_die;
-
- child_die = die->child;
- while (child_die && child_die->tag)
+ for (die_info *child_die : die->children ())
{
if (child_die->tag != DW_TAG_enumerator)
{
@@ -11851,8 +11778,6 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
}
else
new_symbol (child_die, this_type, cu);
-
- child_die = child_die->sibling;
}
}
@@ -12033,9 +11958,7 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
int bounds_offset = -1;
int max_align = -1;
std::vector<struct field> range_fields;
- for (struct die_info *child_die = die->child;
- child_die;
- child_die = child_die->sibling)
+ for (die_info *child_die : die->children ())
{
if (child_die->tag == DW_TAG_subrange_type)
{
@@ -12136,7 +12059,6 @@ static struct type *
read_array_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->per_objfile->objfile;
- struct die_info *child_die;
struct type *type;
struct type *element_type, *range_type, *index_type;
struct attribute *attr;
@@ -12191,8 +12113,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
}
std::vector<struct type *> range_types;
- child_die = die->child;
- while (child_die && child_die->tag)
+ for (die_info *child_die : die->children ())
{
if (child_die->tag == DW_TAG_subrange_type
|| child_die->tag == DW_TAG_generic_subrange)
@@ -12206,7 +12127,6 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
range_types.push_back (child_type);
}
}
- child_die = child_die->sibling;
}
if (range_types.empty ())
@@ -12473,15 +12393,12 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
if (die->child != NULL)
{
struct objfile *objfile = cu->per_objfile->objfile;
- struct die_info *child_die;
- size_t n_entries = 0, size;
+ size_t size;
struct common_block *common_block;
struct symbol *sym;
- for (child_die = die->child;
- child_die && child_die->tag;
- child_die = child_die->sibling)
- ++n_entries;
+ auto range = die->children ();
+ size_t n_entries = std::distance (range.begin (), range.end ());
size = (sizeof (struct common_block)
+ (n_entries - 1) * sizeof (struct symbol *));
@@ -12491,9 +12408,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
memset (common_block->contents, 0, n_entries * sizeof (struct symbol *));
common_block->n_entries = 0;
- for (child_die = die->child;
- child_die && child_die->tag;
- child_die = child_die->sibling)
+ for (die_info *child_die : die->children ())
{
/* Create the symbol in the DW_TAG_common_block block in the current
symbol scope. */
@@ -12616,13 +12531,8 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
if (die->child != NULL)
{
- struct die_info *child_die = die->child;
-
- while (child_die && child_die->tag)
- {
- process_die (child_die, cu);
- child_die = child_die->sibling;
- }
+ for (die_info *child_die : die->children ())
+ process_die (child_die, cu);
}
}
@@ -12660,17 +12570,13 @@ read_module_type (struct die_info *die, struct dwarf2_cu *cu)
static void
read_module (struct die_info *die, struct dwarf2_cu *cu)
{
- struct die_info *child_die = die->child;
struct type *type;
type = read_type_die (die, cu);
new_symbol (die, type, cu);
- while (child_die && child_die->tag)
- {
- process_die (child_die, cu);
- child_die = child_die->sibling;
- }
+ for (die_info *child_die : die->children ())
+ process_die (child_die, cu);
}
/* Return the name of the namespace represented by DIE. Set
@@ -13168,22 +13074,18 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
if (die->child != NULL)
{
struct type *void_type = builtin_type (objfile)->builtin_void;
- struct die_info *child_die;
int nparams, iparams;
/* Count the number of parameters.
FIXME: GDB currently ignores vararg functions, but knows about
vararg member functions. */
nparams = 0;
- child_die = die->child;
- while (child_die && child_die->tag)
+ for (die_info *child_die : die->children ())
{
if (child_die->tag == DW_TAG_formal_parameter)
nparams++;
else if (child_die->tag == DW_TAG_unspecified_parameters)
ftype->set_has_varargs (true);
-
- child_die = child_die->sibling;
}
/* Allocate storage for parameters and fill them in. */
@@ -13195,8 +13097,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
ftype->field (iparams).set_type (void_type);
iparams = 0;
- child_die = die->child;
- while (child_die && child_die->tag)
+ for (die_info *child_die : die->children ())
{
if (child_die->tag == DW_TAG_formal_parameter)
{
@@ -13253,7 +13154,6 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
ftype->field (iparams).set_type (arg_type);
iparams++;
}
- child_die = child_die->sibling;
}
}
@@ -14350,7 +14250,7 @@ read_unspecified_type (struct die_info *die, struct dwarf2_cu *cu)
return set_die_type (die, type, cu);
}
-/* Read a single die and all its descendents. Set the die's sibling
+/* Read a single die and all its descendents. Set the die's next
field to NULL; set other fields in the die correctly, and set all
of the descendents' fields correctly. PARENT is the parent of the
die in question. */
@@ -14371,7 +14271,7 @@ cutu_reader::read_die_and_children (die_info *parent)
else
die->child = nullptr;
- die->sibling = nullptr;
+ die->next = nullptr;
die->parent = parent;
return die;
}
@@ -14396,7 +14296,7 @@ cutu_reader::read_die_and_siblings (die_info *parent)
if (first_die == nullptr)
first_die = die;
else
- last_sibling->sibling = die;
+ last_sibling->next = die;
last_sibling = die;
}
@@ -14435,7 +14335,7 @@ cutu_reader::read_all_dies ()
and updating die_info::num_attrs.
Return a newly allocated die with its information, except for its
- child, sibling, and parent fields. */
+ child, next, and parent fields. */
die_info *
cutu_reader::read_full_die (int num_extra_attrs, bool allow_reprocess)
@@ -14479,7 +14379,7 @@ cutu_reader::read_full_die (int num_extra_attrs, bool allow_reprocess)
/* Read a die and all its attributes.
Return a newly allocated die with its information, except for its
- child, sibling, and parent fields. */
+ child, next, and parent fields. */
die_info *
cutu_reader::read_toplevel_die (gdb::array_view<attribute *> extra_attrs)
@@ -17767,7 +17667,6 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
{
struct die_info *spec_die;
struct dwarf2_cu *spec_cu;
- struct die_info *child;
struct objfile *objfile = cu->per_objfile->objfile;
spec_cu = cu;
@@ -17778,9 +17677,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
cu = spec_cu;
}
- for (child = die->child;
- child != NULL;
- child = child->sibling)
+ for (die_info *child : die->children ())
{
if (child->tag == DW_TAG_subprogram)
{
@@ -18106,18 +18003,19 @@ unnamed_template_tag_name (die_info *die, dwarf2_cu *cu)
arrive at our entry. */
size_t nth_unnamed = 0;
- die_info *child = die->parent->child;
- while (child != die)
- {
- gdb_assert (child != nullptr);
- if (child->tag == DW_TAG_template_type_param
- || child->tag == DW_TAG_template_value_param)
- {
- if (dwarf2_attr (child, DW_AT_name, cu) == nullptr)
- ++nth_unnamed;
- }
- child = child->sibling;
- }
+ for (die_info *child : die->parent->children ())
+ {
+ if (child == die)
+ break;
+
+ gdb_assert (child != nullptr);
+ if (child->tag == DW_TAG_template_type_param
+ || child->tag == DW_TAG_template_value_param)
+ {
+ if (dwarf2_attr (child, DW_AT_name, cu) == nullptr)
+ ++nth_unnamed;
+ }
+ }
const std::string name_str = "<unnamed" + std::to_string (nth_unnamed) + ">";
return cu->per_objfile->objfile->intern (name_str.c_str ());
diff --git a/gdb/gcore-1.in b/gdb/gcore-1.in
index 129e369..c0979a5 100644
--- a/gdb/gcore-1.in
+++ b/gdb/gcore-1.in
@@ -20,8 +20,8 @@
# It starts up gdb, attaches to the given PID and invokes the gcore command.
#
-PKGVERSION=@PKGVERSION@
-VERSION=@VERSION@
+PKGVERSION="@PKGVERSION@"
+VERSION="@VERSION@"
# Need to check for -o option, but set default basename to "core".
prefix=core
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 9d84187..f946c2a 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -778,9 +778,6 @@ check_thread_db (struct thread_db_info *info, bool log_progress)
}
catch (const gdb_exception_error &except)
{
- if (warning_pre_print)
- gdb_puts (warning_pre_print, gdb_stderr);
-
exception_fprintf (gdb_stderr, except,
_("libthread_db integrity checks failed: "));
diff --git a/gdb/main.c b/gdb/main.c
index d126e98..b173eb6 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -705,7 +705,7 @@ captured_main_1 (struct captured_main_args *context)
/* Prefix warning messages with the command name. */
gdb::unique_xmalloc_ptr<char> tmp_warn_preprint
- = xstrprintf ("%s: warning: ", gdb_program_name);
+ = xstrprintf ("%s: ", gdb_program_name);
warning_pre_print = tmp_warn_preprint.get ();
current_directory = getcwd (NULL, 0);
@@ -1169,7 +1169,7 @@ captured_main_1 (struct captured_main_args *context)
/* Set off error and warning messages with a blank line. */
tmp_warn_preprint.reset ();
- warning_pre_print = _("\nwarning: ");
+ warning_pre_print = "\n";
/* Read and execute the system-wide gdbinit file, if it exists.
This is done *before* all the command line arguments are
@@ -1274,7 +1274,7 @@ captured_main_1 (struct captured_main_args *context)
current_inferior ()->set_tty (ttyarg);
/* Error messages should no longer be distinguished with extra output. */
- warning_pre_print = _("warning: ");
+ warning_pre_print = "";
/* Read the .gdbinit file in the current directory, *if* it isn't
the same as the $HOME/.gdbinit file (it should exist, also). */
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 5e67073..3f1a206 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -1208,7 +1208,7 @@ public:
private:
template<typename O>
- using StorageKey = typename registry<O>::key<Storage>;
+ using StorageKey = typename registry<O>::template key<Storage>;
template<typename O>
Storage *get_storage (O *owner, const StorageKey<O> &key) const
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index f08c872..30c9e61 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -325,11 +325,26 @@ source_cache::ensure (struct symtab *s)
least one caller. */
if (i != size - 1)
std::swap (m_source_map[i], m_source_map[size - 1]);
- return true;
+
+ /* If the styling status of the cached entry matches our desired
+ styling status, or we know this file cannot be styled, in
+ which case, this (unstyled) content, is the best we can do. */
+ if (((source_styling && gdb_stdout->can_emit_style_escape ())
+ == m_source_map[size - 1].styled)
+ || m_no_styling_files.count (fullname) > 0)
+ return true;
+
+ /* We found a match, but styling status doesn't match the desired
+ styling status. We already moved the matching item to the
+ back of M_SOURCE_MAP, so drop the entry now, and then
+ recompute with the desired styling. */
+ m_source_map.pop_back ();
+ break;
}
}
std::string contents;
+ bool styled_p = false;
try
{
contents = get_plain_source_lines (s, fullname);
@@ -343,21 +358,21 @@ source_cache::ensure (struct symtab *s)
if (source_styling && gdb_stdout->can_emit_style_escape ()
&& m_no_styling_files.count (fullname) == 0)
{
- bool already_styled
+ styled_p
= try_source_highlight (contents, s->language (), fullname);
- if (!already_styled)
+ if (!styled_p)
{
std::optional<std::string> ext_contents;
ext_contents = ext_lang_colorize (fullname, contents);
if (ext_contents.has_value ())
{
contents = std::move (*ext_contents);
- already_styled = true;
+ styled_p = true;
}
}
- if (!already_styled)
+ if (!styled_p)
{
/* Styling failed. Styling can fail for instance for these
reasons:
@@ -374,7 +389,8 @@ source_cache::ensure (struct symtab *s)
}
}
- source_text result = { std::move (fullname), std::move (contents) };
+ source_text result
+ = { std::move (fullname), std::move (contents), styled_p };
m_source_map.push_back (std::move (result));
if (m_source_map.size () > MAX_ENTRIES)
diff --git a/gdb/source-cache.h b/gdb/source-cache.h
index 03f4b79..c7d204b 100644
--- a/gdb/source-cache.h
+++ b/gdb/source-cache.h
@@ -78,6 +78,8 @@ private:
std::string fullname;
/* The contents of the file. */
std::string contents;
+ /* True if CONTENTS are styled. Otherwise, false. */
+ bool styled;
};
/* A helper function for get_source_lines reads a source file.
diff --git a/gdb/testsuite/gdb.python/py-source-styling.exp b/gdb/testsuite/gdb.python/py-source-styling.exp
index ba7e795..8eed56b 100644
--- a/gdb/testsuite/gdb.python/py-source-styling.exp
+++ b/gdb/testsuite/gdb.python/py-source-styling.exp
@@ -33,12 +33,43 @@ if { [build_executable "failed to build" ${testfile} ${srcfile}] == -1 } {
set line_number [gdb_get_line_number "List this line."]
+# Helper proc. Run CMD, which should produce a source listing, and
+# check if the source code is styled or not. EXPECT_STYLED indicates
+# if we expect the source listing to be styled or not.
+proc check_source_listing_styling { cmd expect_styled { testname "" } } {
+ if { $testname eq "" } {
+ set testname $cmd
+ }
+
+ set seen_style_escape false
+ gdb_test_multiple $cmd $testname {
+ -re -wrap "Python Exception.*" {
+ fail $gdb_test_name
+ return
+ }
+ -re "\033" {
+ set seen_style_escape true
+ exp_continue
+ }
+ -re "$::gdb_prompt $" {
+ gdb_assert { $seen_style_escape == $expect_styled } \
+ $gdb_test_name
+ }
+ }
+}
+
# Check that the Python pygments module can be used for source
# highlighting when GNU source highlight is not available (or is
# disabled, as is done in this test).
proc test_pygments_styling {} {
clean_restart $::binfile
+ # Remote host boards disable styling via GDB's command line. Turn
+ # it back on now.
+ if {[is_remote host]} {
+ gdb_test "set style enabled on"
+ }
+
if { ![gdb_py_module_available "pygments"] } {
unsupported "pygments module not available"
return
@@ -52,19 +83,7 @@ proc test_pygments_styling {} {
gdb_test "maint flush source-cache" "Source cache flushed\\."
- set seen_style_escape false
- gdb_test_multiple "list $::line_number" "" {
- -re "Python Exception.*" {
- fail $gdb_test_name
- }
- -re "\033" {
- set seen_style_escape true
- exp_continue
- }
- -re "$::gdb_prompt $" {
- gdb_assert { $seen_style_escape } $gdb_test_name
- }
- }
+ check_source_listing_styling "list $::line_number" true
}
# Use gdb.execute to list source code containing non-utf-8 character.
@@ -93,6 +112,67 @@ proc test_gdb_execute_non_utf8_source {} {
gdb_test "python print(source)" ".*List this line.*"
}
+# Use gdb.execute() to list source code. Alternate between asking for
+# styled, and unstyled source code. In some cases we ask for the
+# output to be returned via a string, and in other cases we ask for
+# the output to be sent straight to stdout.
+proc_with_prefix test_source_cache_style_tracking {} {
+ clean_restart $::binfile
+
+ # Remote host boards disable styling via GDB's command line. Turn
+ # it back on now.
+ if {[is_remote host]} {
+ gdb_test "set style enabled on"
+ }
+
+ gdb_test_no_output "set host-charset ISO-8859-1"
+
+ # Commands which return styled, and non-styled source code mixed
+ # together. This ensures that the source cache will need to keep
+ # discarding the entry with the wrong styling mode. All of these
+ # gdb.execute calls send their output via a string.
+ check_source_listing_styling \
+ "python print(gdb.execute('list $::line_number', to_string=True), end='')" \
+ false
+ check_source_listing_styling \
+ "python print(gdb.execute('list $::line_number', to_string=True, styling=True), end='')" \
+ true
+ foreach from_tty { True False } {
+ check_source_listing_styling \
+ "python print(gdb.execute('list $::line_number', $from_tty, True), end='')" \
+ false
+ check_source_listing_styling \
+ "python print(gdb.execute('list $::line_number', $from_tty, True, True), end='')" \
+ true
+ check_source_listing_styling \
+ "python print(gdb.execute('list $::line_number', $from_tty, True, False), end='')" \
+ false
+ }
+
+ # The same again, but this time the output is sent directly to
+ # stdout.
+ check_source_listing_styling \
+ "python gdb.execute('list $::line_number')" \
+ true
+ check_source_listing_styling \
+ "python gdb.execute('list $::line_number', to_string=False, styling=False)" \
+ false
+ check_source_listing_styling \
+ "python gdb.execute('list $::line_number', to_string=False, styling=True)" \
+ true
+ foreach from_tty { True False } {
+ check_source_listing_styling \
+ "python gdb.execute('list $::line_number', $from_tty, False, False)" \
+ false
+ check_source_listing_styling \
+ "python gdb.execute('list $::line_number', $from_tty, False, True)" \
+ true
+ check_source_listing_styling \
+ "python gdb.execute('list $::line_number', $from_tty, False)" \
+ true
+ }
+}
+
# We need an ANSI-capable terminal to get the output, additionally we
# need to set LC_ALL so GDB knows the terminal is UTF-8 capable,
# otherwise we'll get a UnicodeEncodeError trying to encode the
@@ -100,4 +180,5 @@ proc test_gdb_execute_non_utf8_source {} {
with_ansi_styling_terminal {
test_pygments_styling
test_gdb_execute_non_utf8_source
+ test_source_cache_style_tracking
}
diff --git a/gdb/testsuite/gdb.rocm/precise-memory.cpp b/gdb/testsuite/gdb.rocm/precise-memory.cpp
index 769b58a..7a8c37e 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory.cpp
+++ b/gdb/testsuite/gdb.rocm/precise-memory.cpp
@@ -31,7 +31,17 @@
__global__ void
kernel ()
{
- __builtin_amdgcn_s_sleep (1);
+
+ /* Simple kernel which loads from address 0 to trigger a pagefault.
+ When precise memory is not enabled, it is expected that the memory fault
+ is reported after the s_nop instruction. With precise-memory, the
+ exception should be reported on the s_nop. */
+ asm volatile ("s_mov_b64 [s10, s11], 0\n"
+ "s_load_dword s12, [s10, s11]\n"
+ "s_nop 0"
+ :
+ :
+ : "s10", "s11", "s12");
}
int
diff --git a/gdb/testsuite/gdb.rocm/precise-memory.exp b/gdb/testsuite/gdb.rocm/precise-memory.exp
index f423a11..8c39f80 100644
--- a/gdb/testsuite/gdb.rocm/precise-memory.exp
+++ b/gdb/testsuite/gdb.rocm/precise-memory.exp
@@ -39,18 +39,40 @@ proc do_test { } {
"AMDGPU precise memory access reporting is off \\(currently disabled\\)." \
"show precise-memory setting in CLI before"
- if {[hip_devices_support_precise_memory]} {
- gdb_test_no_output "set amdgpu precise-memory on"
- set cli_effective_value "enabled"
- } else {
- gdb_test "set amdgpu precise-memory on" \
- "warning: AMDGPU precise memory access reporting could not be enabled."
- set cli_effective_value "disabled"
+ # Assume precise-memory is available, unless GDB reports otherwise.
+ gdb_test_multiple "set amdgpu precise-memory on" "" {
+ -re -wrap "warning: AMDGPU precise memory access reporting could not be enabled\\." {
+ set cli_effective_value "disabled"
+ pass $gdb_test_name
+ }
+ -re -wrap "^" {
+ set cli_effective_value "enabled"
+ pass $gdb_test_name
+ }
}
gdb_test "show amdgpu precise-memory" \
- "AMDGPU precise memory access reporting is on \\(currently ${cli_effective_value}\\)." \
+ "AMDGPU precise memory access reporting is on \\(currently ${cli_effective_value}\\)\\." \
"show precise-memory setting in CLI after"
+
+ if { $cli_effective_value eq "disabled" } {
+ return
+ }
+
+ # Get to the begining of the GPU kernel without precise memory enabled.
+ with_test_prefix "goto gpu code" {
+ gdb_test_no_output "set amdgpu precise-memory off"
+ gdb_breakpoint "kernel" allow-pending
+ gdb_test "continue" "Thread ${::decimal}.* hit Breakpoint .*"
+ gdb_test_no_output "set amdgpu precise-memory on"
+ }
+
+ # If precise-memory is available, run until a SIGSEGV is reported. At
+ # that point, the PC should point to the s_nop instruction (the one
+ # following the one which caused the memory violation).
+ gdb_test "continue" "Thread ${::decimal}\[^\r\n\]* received signal SIGSEGV, Segmentation fault.*"
+
+ gdb_test "x/i \$pc" "=> ${::hex} <_Z6kernelv\\+${::decimal}>:\[ \t\]+s_nop\[ \t\]+0"
}
}
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
index 2e23f12..d0707cd 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
@@ -43,6 +43,7 @@ function_that_segfaults ()
{
int *p = 0;
*p = 1; /* Segfault happens here. */
+ return 0;
}
int
@@ -55,6 +56,7 @@ void *
worker_func (void *arg)
{
int a = 42; /* Breakpoint here. */
+ return NULL;
}
void
diff --git a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
index c9508c9..feec37b 100644
--- a/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
+++ b/gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
@@ -79,7 +79,7 @@ proc run_condition_test { message n_expected_hits condition \
gdb_breakpoint \
"${::srcfile}:${::cond_bp_line} if ((++\$n_cond_eval) && (${condition}))"
- # And a breakpoint that we hit when the test is over, this one is
+ # Add a breakpoint that we hit when the test is over, this one is
# not conditional. Only the main thread gets here once all the
# other threads have finished.
gdb_breakpoint "${::srcfile}:${::stop_bp_line}"
@@ -114,7 +114,7 @@ proc run_condition_test { message n_expected_hits condition \
# includes an inferior call), it is still possible to kill the running
# inferior, and then restart the inferior.
#
-# At once point doing this would result in GDB giving an assertion error.
+# At one point doing this would result in GDB giving an assertion error.
proc_with_prefix run_kill_and_restart_test { target_async target_non_stop } {
# This test relies on the 'start' command, which is not possible with
# the plain 'remote' target.
diff --git a/gdb/testsuite/lib/rocm.exp b/gdb/testsuite/lib/rocm.exp
index 3eb51db..5164f1e 100644
--- a/gdb/testsuite/lib/rocm.exp
+++ b/gdb/testsuite/lib/rocm.exp
@@ -176,22 +176,3 @@ proc hip_devices_support_debug_multi_process {} {
}
return 1
}
-
-# Return true if all the devices on the host support precise memory.
-
-proc hip_devices_support_precise_memory {} {
- set unsupported_targets \
- {gfx900 gfx906 gfx908 gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032}
-
- set targets [find_amdgpu_devices]
- if { [llength $targets] == 0 } {
- return 0
- }
-
- foreach target $targets {
- if { [lsearch -exact $unsupported_targets $target] != -1 } {
- return 0
- }
- }
- return 1
-}
diff --git a/gdb/utils.c b/gdb/utils.c
index 3d216e1..ee7cf4d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -119,7 +119,7 @@ show_sevenbit_strings (struct ui_file *file, int from_tty,
/* String to be printed before warning messages, if any. */
-const char *warning_pre_print = "\nwarning: ";
+const char *warning_pre_print = "\n";
bool pagination_enabled = true;
static void
@@ -176,8 +176,8 @@ vwarning (const char *string, va_list args)
term_state.emplace ();
target_terminal::ours_for_output ();
}
- if (warning_pre_print)
- gdb_puts (warning_pre_print, gdb_stderr);
+ gdb_puts (warning_pre_print, gdb_stderr);
+ gdb_puts (_("warning: "), gdb_stderr);
gdb_vprintf (gdb_stderr, string, args);
gdb_printf (gdb_stderr, "\n");
}
diff --git a/gdbsupport/common-inferior.h b/gdbsupport/common-inferior.h
index 3e8ec10..a277e1b 100644
--- a/gdbsupport/common-inferior.h
+++ b/gdbsupport/common-inferior.h
@@ -54,7 +54,7 @@ extern bool startup_with_shell;
/* Combine elements of ARGV into a single string, placing a single
whitespace character between each element. When ESCAPE_SHELL_CHAR is
- true then any special shell characters in elemets of ARGV will be
+ true then any special shell characters in elements of ARGV will be
escaped. When ESCAPE_SHELL_CHAR is false only the characters that GDB
sees as special (quotes and whitespace) are escaped. */
extern std::string
diff --git a/ld/testsuite/ld-x86-64/pr19636-3d.d b/ld/testsuite/ld-x86-64/pr19636-3d.d
deleted file mode 100644
index 3d9a6d7..0000000
--- a/ld/testsuite/ld-x86-64/pr19636-3d.d
+++ /dev/null
@@ -1,10 +0,0 @@
-#source: pr19636-3.s
-#as: --64
-#ld: -E --defsym foobar=0x100 -m elf_x86_64
-#readelf : --dyn-syms --wide
-
-Symbol table '\.dynsym' contains [0-9]+ entries:
- +Num: +Value +Size Type +Bind +Vis +Ndx Name
-#...
- +[0-9]+: +0+100 +0 +NOTYPE +GLOBAL +DEFAULT +ABS +foobar
-#pass