aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/.gitattributes5
-rw-r--r--gdb/Makefile.in3
-rw-r--r--gdb/NEWS12
-rw-r--r--gdb/acinclude.m412
-rw-r--r--gdb/ada-exp.y82
-rw-r--r--gdb/ada-lex.l64
-rw-r--r--gdb/alpha-netbsd-tdep.c2
-rw-r--r--gdb/arch/aarch64-mte-linux.c1
-rw-r--r--gdb/block.h2
-rw-r--r--gdb/c-exp.y13
-rw-r--r--gdb/c-lang.c2
-rw-r--r--gdb/c-lang.h1
-rw-r--r--gdb/c-varobj.c8
-rw-r--r--gdb/cli/cli-cmds.c8
-rw-r--r--gdb/cli/cli-utils.c1
-rw-r--r--gdb/config.in6
-rw-r--r--gdb/config/i386/nm-x86-gnu.h4
-rwxr-xr-xgdb/configure74
-rw-r--r--gdb/configure.ac20
-rwxr-xr-xgdb/contrib/check-whitespace-pre-commit.py52
-rwxr-xr-xgdb/contrib/check-whitespace-pre-commit.sh19
-rw-r--r--gdb/cp-name-parser.y20
-rw-r--r--gdb/d-exp.y1
-rw-r--r--gdb/d-namespace.c1
-rw-r--r--gdb/darwin-nat-info.c2
-rw-r--r--gdb/doc/gdb.texinfo26
-rw-r--r--gdb/doc/guile.texi2
-rw-r--r--gdb/dwarf2/abbrev.h2
-rw-r--r--gdb/dwarf2/loc.c52
-rw-r--r--gdb/f-exp.y120
-rw-r--r--gdb/guile/guile-internal.h12
-rw-r--r--gdb/guile/guile.c4
-rw-r--r--gdb/guile/scm-safe-call.c2
-rw-r--r--gdb/i386-syscalls.def2
-rw-r--r--gdb/infcmd.c112
-rw-r--r--gdb/jit.c2
-rw-r--r--gdb/linespec.c15
-rw-r--r--gdb/linux-tdep.c2
-rw-r--r--gdb/m2-exp.y16
-rw-r--r--gdb/m68hc11-tdep.c1
-rw-r--r--gdb/mdebugread.c4
-rw-r--r--gdb/mi/mi-cmd-break.c1
-rw-r--r--gdb/mi/mi-cmd-catch.c1
-rw-r--r--gdb/mi/mi-cmd-target.c1
-rw-r--r--gdb/mn10300-linux-tdep.c1
-rw-r--r--gdb/mn10300-tdep.c1
-rw-r--r--gdb/p-exp.y10
-rwxr-xr-xgdb/po/gdbtext3
-rw-r--r--gdb/ppc-sysv-tdep.c2
-rw-r--r--gdb/rs6000-aix-tdep.c1
-rw-r--r--gdb/rs6000-lynx178-tdep.c1
-rw-r--r--gdb/solib-rocm.c1
-rw-r--r--gdb/split-name.c1
-rw-r--r--gdb/std-operator.def12
-rw-r--r--gdb/symtab.h2
-rw-r--r--gdb/target-float.c1
-rw-r--r--gdb/testsuite/gdb.base/environ.exp25
-rw-r--r--gdb/testsuite/gdb.base/list-multi-source.c60
-rw-r--r--gdb/testsuite/gdb.base/list-multi-source.exp129
-rw-r--r--gdb/testsuite/gdb.base/local-env.exp133
-rw-r--r--gdb/testsuite/gdb.base/long_long.exp32
-rw-r--r--gdb/testsuite/gdb.multi/remote-with-running-inferior.exp26
-rw-r--r--gdb/testsuite/gdb.rocm/break-kernel-no-debug-info.exp2
-rw-r--r--gdb/unittests/child-path-selftests.c1
-rw-r--r--gdb/unittests/mkdir-recursive-selftests.c1
-rw-r--r--gdb/unwind_stop_reasons.def8
66 files changed, 806 insertions, 439 deletions
diff --git a/gdb/.gitattributes b/gdb/.gitattributes
index cf72455..a3f15e9 100644
--- a/gdb/.gitattributes
+++ b/gdb/.gitattributes
@@ -15,3 +15,8 @@
configure -whitespace
aclocal.m4 -whitespace
+
+# Tab-indented files.
+
+*.[ly] whitespace=space-before-tab,indent-with-non-tab,trailing-space
+*.def whitespace=space-before-tab,indent-with-non-tab,trailing-space
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index ed29f17..daed1ec 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2705,7 +2705,8 @@ $(PACKAGE).pot: po/$(PACKAGE).pot
po/$(PACKAGE).pot: force
-test -d po || mkdir po
sh -e $(srcdir)/po/gdbtext $(XGETTEXT) $(PACKAGE) . $(srcdir) \
- $(srcdir)/../gdbsupport $(srcdir)/../gdbserver
+ $(srcdir)/../gdbsupport $(srcdir)/../gdbserver \
+ $(addprefix $(srcdir)/,$(CONFIG_SRC_SUBDIR))
#
diff --git a/gdb/NEWS b/gdb/NEWS
index 01c998f..3b0a7f7 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -6,6 +6,9 @@
* Support for .gdb_index sections with version less than 7 has been
removed.
+* Support for Guile 2.0 has been removed. Guile 2.2 is now the minimal
+ supported Guile version.
+
* GDB now accepts --no-escape-args as an alternative to --args on the
command line. GDB will not escape special shell characters within
arguments after --no-escape-args.
@@ -55,6 +58,13 @@ GNU/Linux/MicroBlaze (gdbserver) microblazeel-*linux*
* New commands
+set local-environment
+show local-environment
+unset local-environment
+ Analogs of the existing "environment" commands that affect GDB's own
+ environment. The local environment is used by "shell", "pipe", and
+ other commands that launch a subprocess other than an inferior.
+
maintenance test-remote-args ARGS
Test splitting and joining of inferior arguments ARGS as they would
be split and joined when being passed to a remote target.
@@ -1871,7 +1881,7 @@ GNU/Linux/OpenRISC or1k*-*-linux*
the '-force' flag of the CLI's "cond" command.
** '-file-list-exec-source-files [--group-by-objfile]
- [--basename | --dirname]
+ [--basename | --dirname]
[--] [REGEXP]'
The existing -file-list-exec-source-files command now takes an
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index f2cd187..547dd14 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -267,17 +267,7 @@ dnl similar to Guile's 'GUILE_PROGS' macro.)
AC_DEFUN([GDB_GUILE_PROGRAM_NAMES], [
AC_CACHE_CHECK([for the absolute file name of the 'guild' command],
[ac_cv_guild_program_name],
- [ac_cv_guild_program_name="`$1 --variable guild $2`"
-
- # In Guile up to 2.0.11 included, guile-2.0.pc would not define
- # the 'guild' and 'bindir' variables. In that case, try to guess
- # what the program name is, at the risk of getting it wrong if
- # Guile was configured with '--program-suffix' or similar.
- if test "x$ac_cv_guild_program_name" = "x"; then
- guile_exec_prefix="`$1 --variable exec_prefix $2`"
- ac_cv_guild_program_name="$guile_exec_prefix/bin/guild"
- fi
- ])
+ [ac_cv_guild_program_name="`$1 --variable guild $2`"])
if ! "$ac_cv_guild_program_name" --version >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
AC_MSG_ERROR(['$ac_cv_guild_program_name' appears to be unusable])
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index c87b91e..09074e6 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -483,7 +483,7 @@ make_tick_completer (struct stoken tok)
}
%type <lval> positional_list component_groups component_associations
-%type <lval> aggregate_component_list
+%type <lval> aggregate_component_list
%type <tval> var_or_type type_prefix opt_type_prefix
%token <typed_val> INT NULL_PTR
@@ -509,7 +509,7 @@ make_tick_completer (struct stoken tok)
%left '*' '/' MOD REM
%right STARSTAR ABS NOT
-/* Artificial token to give NAME => ... and NAME | priority over reducing
+/* Artificial token to give NAME => ... and NAME | priority over reducing
NAME to <primary> and to give <primary>' priority over reducing <primary>
to <simple_exp>. */
%nonassoc VAR
@@ -620,7 +620,7 @@ primary :
primary '(' simple_exp DOTDOT simple_exp ')'
{ ada_wrap3<ada_ternop_slice_operation> (); }
| var_or_type '(' simple_exp DOTDOT simple_exp ')'
- { if ($1 == NULL)
+ { if ($1 == NULL)
ada_wrap3<ada_ternop_slice_operation> ();
else
error (_("Cannot slice a type"));
@@ -632,7 +632,7 @@ primary : '(' exp1 ')' { }
/* The following rule causes a conflict with the type conversion
var_or_type (exp)
- To get around it, we give '(' higher priority and add bridge rules for
+ To get around it, we give '(' higher priority and add bridge rules for
var_or_type (exp, exp, ...)
var_or_type (exp .. exp)
We also have the action for var_or_type(exp) generate a function call
@@ -653,7 +653,7 @@ primary : aggregate
pstate->push_new<ada_aggregate_operation>
(pop_component ());
}
- ;
+ ;
primary : '@'
{
@@ -715,7 +715,7 @@ arglist : exp
primary : '{' var_or_type '}' primary %prec '.'
/* GDB extension */
- {
+ {
if ($2 == NULL)
error (_("Type required within braces in coercion"));
operation_up arg = ada_pop ();
@@ -786,8 +786,8 @@ relation : simple_exp IN simple_exp DOTDOT simple_exp
pstate->push_new<ada_binop_in_bounds_operation>
(std::move (lhs), std::move (rhs), $5);
}
- | simple_exp IN var_or_type %prec TICK_ACCESS
- {
+ | simple_exp IN var_or_type %prec TICK_ACCESS
+ {
if ($3 == NULL)
error (_("Right operand of 'in' must be type"));
operation_up arg = ada_pop ();
@@ -805,8 +805,8 @@ relation : simple_exp IN simple_exp DOTDOT simple_exp
(std::move (lhs), std::move (rhs), $6);
ada_wrap<unary_logical_not_operation> ();
}
- | simple_exp NOT IN var_or_type %prec TICK_ACCESS
- {
+ | simple_exp NOT IN var_or_type %prec TICK_ACCESS
+ {
if ($4 == NULL)
error (_("Right operand of 'in' must be type"));
operation_up arg = ada_pop ();
@@ -837,7 +837,7 @@ exp : relation
;
and_exp :
- relation _AND_ relation
+ relation _AND_ relation
{ ada_wrap2<bitwise_and_operation>
(BINOP_BITWISE_AND); }
| and_exp _AND_ relation
@@ -855,7 +855,7 @@ and_then_exp :
;
or_exp :
- relation OR relation
+ relation OR relation
{ ada_wrap2<bitwise_ior_operation>
(BINOP_BITWISE_IOR); }
| or_exp OR relation
@@ -878,13 +878,13 @@ xor_exp : relation XOR relation
(BINOP_BITWISE_XOR); }
;
-/* Primaries can denote types (OP_TYPE). In cases such as
+/* Primaries can denote types (OP_TYPE). In cases such as
primary TICK_ADDRESS, where a type would be invalid, it will be
caught when evaluate_subexp in ada-lang.c tries to evaluate the
primary, expecting a value. Precedence rules resolve the ambiguity
in NAME TICK_ACCESS in favor of shifting to form a var_or_type. A
construct such as aType'access'access will again cause an error when
- aType'access evaluates to a type that evaluate_subexp attempts to
+ aType'access evaluates to a type that evaluate_subexp attempts to
evaluate. */
primary : primary TICK_ACCESS
{ ada_addrof (); }
@@ -963,7 +963,7 @@ tick_arglist : %prec '('
type_prefix :
var_or_type
- {
+ {
if ($1 == NULL)
error (_("Prefix must be type"));
$$ = $1;
@@ -1011,7 +1011,7 @@ primary : NULL_PTR
;
primary : STRING
- {
+ {
pstate->push_new<ada_string_operation>
(copy_name ($1));
}
@@ -1049,8 +1049,8 @@ var_or_type: NAME %prec VAR
$1,
$2);
}
- | NAME TICK_ACCESS
- {
+ | NAME TICK_ACCESS
+ {
$$ = write_var_or_type (pstate, NULL, $1);
if ($$ == NULL)
ada_addrof ();
@@ -1058,7 +1058,7 @@ var_or_type: NAME %prec VAR
$$ = lookup_pointer_type ($$);
}
| block NAME TICK_ACCESS
- {
+ {
$$ = write_var_or_type (pstate, $1, $2);
if ($$ == NULL)
ada_addrof ();
@@ -1112,12 +1112,12 @@ positional_list :
push_component<ada_positional_component>
(0, ada_pop ());
$$ = 1;
- }
+ }
| positional_list exp ','
{
push_component<ada_positional_component>
($1, ada_pop ());
- $$ = $1 + 1;
+ $$ = $1 + 1;
}
;
@@ -1171,8 +1171,8 @@ component_group :
/* We use this somewhat obscure definition in order to handle NAME => and
NAME | differently from exp => and exp |. ARROW and '|' have a precedence
- above that of the reduction of NAME to var_or_type. By delaying
- decisions until after the => or '|', we convert the ambiguity to a
+ above that of the reduction of NAME to var_or_type. By delaying
+ decisions until after the => or '|', we convert the ambiguity to a
resolved shift/reduce conflict. */
component_associations :
NAME ARROW exp
@@ -1308,12 +1308,12 @@ write_int (struct parser_state *par_state, LONGEST arg, struct type *type)
ada_wrap<ada_wrapped_operation> ();
}
-/* Emit expression corresponding to the renamed object named
+/* Emit expression corresponding to the renamed object named
designated by RENAMED_ENTITY[0 .. RENAMED_ENTITY_LEN-1] in the
context of ORIG_LEFT_CONTEXT, to which is applied the operations
encoded by RENAMING_EXPR. MAX_DEPTH is the maximum number of
cascaded renamings to allow. If ORIG_LEFT_CONTEXT is null, it
- defaults to the currently selected block. ORIG_SYMBOL is the
+ defaults to the currently selected block. ORIG_SYMBOL is the
symbol that originally encoded the renaming. It is needed only
because its prefix also qualifies any index variables used to index
or slice an array. It should not be necessary once we go to the
@@ -1510,7 +1510,7 @@ select_possible_type_sym (const std::vector<struct block_symbol> &syms)
int i;
int preferred_index;
struct type *preferred_type;
-
+
preferred_index = -1; preferred_type = NULL;
for (i = 0; i < syms.size (); i += 1)
switch (syms[i].symbol->loc_class ())
@@ -1552,7 +1552,7 @@ find_primitive_type (struct parser_state *par_state, const char *name)
/* Check to see if we have a regular definition of this
type that just didn't happen to have been read yet. */
struct symbol *sym;
- char *expanded_name =
+ char *expanded_name =
(char *) alloca (strlen (name) + sizeof ("standard__"));
strcpy (expanded_name, "standard__");
strcat (expanded_name, name);
@@ -1602,7 +1602,7 @@ write_selectors (struct parser_state *par_state, const char *sels)
{
const char *p = chop_separator (sels);
sels = p;
- while (*sels != '\0' && *sels != '.'
+ while (*sels != '\0' && *sels != '.'
&& (sels[0] != '_' || sels[1] != '_'))
sels += 1;
operation_up arg = ada_pop ();
@@ -1678,7 +1678,7 @@ get_symbol_field_type (struct symbol *sym, const char *encoded_field_name)
return type->field (fieldno).type ();
subfield_name = field_name;
- while (*subfield_name != '\0' && *subfield_name != '.'
+ while (*subfield_name != '\0' && *subfield_name != '.'
&& (subfield_name[0] != '_' || subfield_name[1] != '_'))
subfield_name += 1;
@@ -1697,14 +1697,14 @@ get_symbol_field_type (struct symbol *sym, const char *encoded_field_name)
return NULL;
}
-/* Look up NAME0 (an unencoded identifier or dotted name) in BLOCK (or
+/* Look up NAME0 (an unencoded identifier or dotted name) in BLOCK (or
expression_block_context if NULL). If it denotes a type, return
that type. Otherwise, write expression code to evaluate it as an
object and return NULL. In this second case, NAME0 will, in general,
have the form <name>(.<selector_name>)*, where <name> is an object
or renaming encoded in the debugging data. Calls error if no
prefix <name> matches a name in the debugging data (i.e., matches
- either a complete name or, as a wild-card match, the final
+ either a complete name or, as a wild-card match, the final
identifier). */
static struct type*
@@ -1738,7 +1738,7 @@ write_var_or_type (struct parser_state *par_state,
for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1)
{
int tail_index;
-
+
tail_index = name_len;
while (tail_index > 0)
{
@@ -1765,7 +1765,7 @@ write_var_or_type (struct parser_state *par_state,
renaming_sym = type_sym;
else if (syms.size () == 1)
renaming_sym = syms[0].symbol;
- else
+ else
renaming_sym = NULL;
switch (ada_parse_renaming (renaming_sym, &renaming,
@@ -1786,7 +1786,7 @@ write_var_or_type (struct parser_state *par_state,
encoded_name = new_name;
name_len = renaming_len + name_len - tail_index;
goto TryAfterRenaming;
- }
+ }
case ADA_OBJECT_RENAMING:
write_object_renaming (par_state, block, renaming, renaming_len,
renaming_expr, MAX_RENAMING_CHAIN_LENGTH);
@@ -1799,7 +1799,7 @@ write_var_or_type (struct parser_state *par_state,
if (type_sym != NULL)
{
struct type *field_type;
-
+
if (tail_index == name_len)
return type_sym->type ();
@@ -1810,7 +1810,7 @@ write_var_or_type (struct parser_state *par_state,
= get_symbol_field_type (type_sym, encoded_name + tail_index);
if (field_type != NULL)
return field_type;
- else
+ else
error (_("Invalid attempt to select from type: \"%s\"."),
name0.ptr);
}
@@ -1846,12 +1846,12 @@ write_var_or_type (struct parser_state *par_state,
}
if (tail_index == name_len
- && strncmp (encoded_name, "standard__",
+ && strncmp (encoded_name, "standard__",
sizeof ("standard__") - 1) == 0)
error (_("No definition of \"%s\" found."), name0.ptr);
tail_index = chop_selector (encoded_name, tail_index);
- }
+ }
else
{
write_ambiguous_var (par_state, block, encoded_name,
@@ -1869,7 +1869,7 @@ write_var_or_type (struct parser_state *par_state,
error (_("No definition of \"%s\" in current context."), name0.ptr);
else
error (_("No definition of \"%s\" in specified context."), name0.ptr);
-
+
TryAfterRenaming: ;
}
@@ -1957,7 +1957,7 @@ write_var_or_type_completion (struct parser_state *par_state,
As a result, in the (one hopes) rare case that one writes an
aggregate such as (R => 42) where R renames an object or is an
ambiguous name, one must write instead ((R) => 42). */
-
+
static void
write_name_assoc (struct parser_state *par_state, struct stoken name)
{
@@ -1998,7 +1998,7 @@ type_for_char (struct parser_state *par_state, ULONGEST value)
static struct type *
type_system_address (struct parser_state *par_state)
{
- struct type *type
+ struct type *type
= language_lookup_primitive_type (par_state->language (),
par_state->gdbarch (),
"system__address");
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index eec80cf..acd8cf3 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -164,11 +164,11 @@ static void rewind_to_char (int);
}
{NUM10}"#"{NUM16}"."{NUM16}"#"{EXP} {
- error (_("Based real literals not implemented yet."));
+ error (_("Based real literals not implemented yet."));
}
{NUM10}"#"{NUM16}"."{NUM16}"#" {
- error (_("Based real literals not implemented yet."));
+ error (_("Based real literals not implemented yet."));
}
<INITIAL>"'"({GRAPHIC}|\")"'" {
@@ -178,9 +178,9 @@ static void rewind_to_char (int);
}
<INITIAL>"'[\""{HEXDIG}{2,}"\"]'" {
- ULONGEST v = strtoulst (yytext+3, nullptr, 16);
+ ULONGEST v = strtoulst (yytext+3, nullptr, 16);
yylval.typed_char.val = v;
- yylval.typed_char.type = type_for_char (pstate, v);
+ yylval.typed_char.type = type_for_char (pstate, v);
return CHARLIT;
}
@@ -188,29 +188,29 @@ static void rewind_to_char (int);
digits here. Currently there's no support for wide or
wide-wide strings. */
\"({GRAPHIC}|"[\""({HEXDIG}{2,}|\")"\"]")*\" {
- yylval.sval = processString (yytext+1, yyleng-2);
+ yylval.sval = processString (yytext+1, yyleng-2);
return STRING;
}
\" {
- error (_("ill-formed or non-terminated string literal"));
+ error (_("ill-formed or non-terminated string literal"));
}
if {
- rewind_to_char ('i');
+ rewind_to_char ('i');
return 0;
}
task {
- rewind_to_char ('t');
+ rewind_to_char ('t');
return 0;
}
thread{WHITE}+{DIG} {
- /* This keyword signals the end of the expression and
- will be processed separately. */
- rewind_to_char ('t');
+ /* This keyword signals the end of the expression and
+ will be processed separately. */
+ rewind_to_char ('t');
return 0;
}
@@ -243,7 +243,7 @@ xor { return XOR; }
true { return TRUEKEYWORD; }
false { return FALSEKEYWORD; }
- /* ATTRIBUTES */
+ /* ATTRIBUTES */
{TICK}([a-z][a-z_]*)?{COMPLETE}? { BEGIN INITIAL; return processAttribute (yytext); }
@@ -277,17 +277,17 @@ false { return FALSEKEYWORD; }
return 0;
}
else
- {
+ {
ada_parser->paren_depth -= 1;
return ')';
}
}
"."{WHITE}*{ID}{COMPLETE}? {
- yylval.sval = processId (yytext+1, yyleng-1);
+ yylval.sval = processId (yytext+1, yyleng-1);
if (yytext[yyleng - 1] == COMPLETE_CHAR)
return DOT_COMPLETE;
- return DOT_ID;
+ return DOT_ID;
}
"."{WHITE}*{COMPLETE} {
@@ -297,25 +297,25 @@ false { return FALSEKEYWORD; }
}
{ID}({WHITE}*"."{WHITE}*({ID}|\"{OPER}\"))*(" "*"'"|{COMPLETE})? {
- int all_posn = find_dot_all (yytext);
+ int all_posn = find_dot_all (yytext);
- if (all_posn == -1 && yytext[yyleng-1] == '\'')
+ if (all_posn == -1 && yytext[yyleng-1] == '\'')
{
BEGIN BEFORE_QUAL_QUOTE;
yyless (yyleng-1);
}
- else if (all_posn >= 0)
+ else if (all_posn >= 0)
yyless (all_posn);
bool is_completion = yytext[yyleng - 1] == COMPLETE_CHAR;
- yylval.sval = processId (yytext, yyleng);
- return is_completion ? NAME_COMPLETE : NAME;
- }
+ yylval.sval = processId (yytext, yyleng);
+ return is_completion ? NAME_COMPLETE : NAME;
+ }
/* GDB EXPRESSION CONSTRUCTS */
"'"[^']+"'"{WHITE}*:: {
- yyless (yyleng - 2);
+ yyless (yyleng - 2);
yylval.sval = processId (yytext, yyleng);
return NAME;
}
@@ -572,7 +572,7 @@ processId (const char *name0, int len)
}
/* Return TEXT[0..LEN-1], a string literal without surrounding quotes,
- with special hex character notations replaced with characters.
+ with special hex character notations replaced with characters.
Result valid until the next call to ada_parse. */
static struct stoken
@@ -589,13 +589,13 @@ processString (const char *text, int len)
while (p < lim)
{
if (p[0] == '[' && p[1] == '"' && p+2 < lim)
- {
- if (p[2] == '"') /* "...["""]... */
- {
- *q = '"';
+ {
+ if (p[2] == '"') /* "...["""]... */
+ {
+ *q = '"';
p += 4;
}
- else
+ else
{
const char *end;
ULONGEST chr = strtoulst (p + 2, &end, 16);
@@ -604,9 +604,9 @@ processString (const char *text, int len)
*q = (char) chr;
p = end + 1;
}
- }
+ }
else
- *q = *p;
+ *q = *p;
q += 1;
p += 1;
}
@@ -755,8 +755,8 @@ rewind_to_char (int ch)
/* Dummy definition to suppress warnings about unused static definitions. */
typedef void (*dummy_function) ();
-dummy_function ada_flex_use[] =
-{
+dummy_function ada_flex_use[] =
+{
(dummy_function) yyunput
};
diff --git a/gdb/alpha-netbsd-tdep.c b/gdb/alpha-netbsd-tdep.c
index 2122ddf..f885f3f 100644
--- a/gdb/alpha-netbsd-tdep.c
+++ b/gdb/alpha-netbsd-tdep.c
@@ -227,7 +227,7 @@ alphanbsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
static int
alphanbsd_pc_in_sigtramp (struct gdbarch *gdbarch,
- CORE_ADDR pc, const char *func_name)
+ CORE_ADDR pc, const char *func_name)
{
return (nbsd_pc_in_sigtramp (pc, func_name)
|| alphanbsd_sigtramp_offset (gdbarch, pc) >= 0);
diff --git a/gdb/arch/aarch64-mte-linux.c b/gdb/arch/aarch64-mte-linux.c
index 9f433b0..9a27eb6 100644
--- a/gdb/arch/aarch64-mte-linux.c
+++ b/gdb/arch/aarch64-mte-linux.c
@@ -74,4 +74,3 @@ aarch64_mte_unpack_tags (gdb::byte_vector &tags, bool skip_first)
/* Update the original tags vector. */
tags = std::move (unpacked_tags);
}
-
diff --git a/gdb/block.h b/gdb/block.h
index b199663..65e2e20 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -496,7 +496,7 @@ struct blockvector
void set_map (addrmap_fixed *map)
{ m_map = map; }
- /* Block comparison function. Returns true if B1 must be ordered before
+ /* Block comparison function. Returns true if B1 must be ordered before
B2 in a blockvector, false otherwise. */
static bool block_less_than (const struct block *b1, const struct block *b2);
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 8290580..d321e81 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -51,6 +51,7 @@
#include "type-stack.h"
#include "target-float.h"
#include "c-exp.h"
+#include "macroexp.h"
#define parse_type(ps) builtin_type (ps->gdbarch ())
@@ -1883,7 +1884,7 @@ name_not_typename : NAME
the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
=exp) or just an exp. If name_not_typename was ever used in an lvalue
context where only a name could occur, this might be useful.
- | NAME_OR_INT
+ | NAME_OR_INT
*/
| oper
{
@@ -3071,10 +3072,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
if (lookup_symbol (copy.c_str (),
pstate->expression_context_block,
- SEARCH_VFT,
- (par_state->language ()->la_language
- == language_cplus ? &is_a_field_of_this
- : NULL)).symbol
+ SEARCH_VFT, &is_a_field_of_this).symbol
!= NULL)
{
/* The keyword is shadowed. */
@@ -3136,8 +3134,7 @@ classify_name (struct parser_state *par_state, const struct block *block,
std::string copy = copy_name (yylval.sval);
bsym = lookup_symbol (copy.c_str (), block, SEARCH_VFT,
- par_state->language ()->name_of_this ()
- ? &is_a_field_of_this : NULL);
+ &is_a_field_of_this);
if (bsym.symbol && bsym.symbol->loc_class () == LOC_BLOCK)
{
@@ -3172,7 +3169,7 @@ classify_name (struct parser_state *par_state, const struct block *block,
filename. However, if the name was quoted, then it is better
to check for a filename or a block, since this is the only
way the user has of requiring the extension to be used. */
- if ((is_a_field_of_this.type == NULL && !is_after_structop)
+ if ((is_a_field_of_this.type == NULL && !is_after_structop)
|| is_quoted_name)
{
/* See if it's a file name. */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 95bfaa4..59db4c4 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -25,9 +25,7 @@
#include "language.h"
#include "varobj.h"
#include "c-lang.h"
-#include "c-support.h"
#include "valprint.h"
-#include "macroscope.h"
#include "charset.h"
#include "demangle.h"
#include "cp-abi.h"
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index c4f729c..48b3f11 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -28,7 +28,6 @@ struct parser_state;
#include "compile/compile.h"
#include "value.h"
-#include "macroexp.h"
#include "gdbsupport/enum-flags.h"
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 447a19f..41875c5 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -831,11 +831,11 @@ cplus_describe_child (const struct varobj *parent, int index,
{
case 0:
if (children[v_public] > 0)
- access = "public";
+ access = "public";
else if (children[v_private] > 0)
- access = "private";
+ access = "private";
else
- access = "protected";
+ access = "protected";
break;
case 1:
if (children[v_public] > 0)
@@ -846,7 +846,7 @@ cplus_describe_child (const struct varobj *parent, int index,
access = "protected";
}
else if (children[v_private] > 0)
- access = "protected";
+ access = "protected";
break;
case 2:
/* Must be protected. */
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 43c1bc7..cf5571c 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2182,6 +2182,14 @@ print_sal_location (const symtab_and_line &sal)
const char *sym_name = NULL;
if (sal.symbol != NULL)
sym_name = sal.symbol->print_name ();
+ else if (CORE_ADDR line_pc;
+ find_pc_for_line (sal.symtab, sal.line, &line_pc))
+ {
+ struct symbol *sym = find_symbol_for_pc (line_pc);
+ if (sym != nullptr)
+ sym_name = sym->print_name ();
+ }
+
gdb_printf (_("file: \"%ps\", line number: %ps, symbol: \"%s\"\n"),
styled_string (file_name_style.style (),
symtab_to_filename_for_display (sal.symtab)),
diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c
index 8396f74..3d0034e 100644
--- a/gdb/cli/cli-utils.c
+++ b/gdb/cli/cli-utils.c
@@ -436,4 +436,3 @@ validate_flags_qcs (const char *which_command, qcs_flags *flags)
if (flags->cont && flags->silent)
error (_("%s: -c and -s are mutually exclusive"), which_command);
}
-
diff --git a/gdb/config.in b/gdb/config.in
index 2a2dcb8..9e2bba4 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -238,9 +238,6 @@
/* Define if Guile interpreter is being linked in. */
#undef HAVE_GUILE
-/* Define if Guile supports manual finalization. */
-#undef HAVE_GUILE_MANUAL_FINALIZATION
-
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
@@ -421,9 +418,6 @@
/* Define to 1 if you have the `sbrk' function. */
#undef HAVE_SBRK
-/* Define to 1 if you have the `scm_new_smob' function. */
-#undef HAVE_SCM_NEW_SMOB
-
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
diff --git a/gdb/config/i386/nm-x86-gnu.h b/gdb/config/i386/nm-x86-gnu.h
index 0ddde30..1724f5f 100644
--- a/gdb/config/i386/nm-x86-gnu.h
+++ b/gdb/config/i386/nm-x86-gnu.h
@@ -29,9 +29,9 @@
((((struct i386_thread_state *) (state))->rfl &= ~0x100), 1)
#else
#define THREAD_STATE_SET_TRACED(state) \
- ((struct i386_thread_state *) (state))->efl |= 0x100
+ ((struct i386_thread_state *) (state))->efl |= 0x100
#define THREAD_STATE_CLEAR_TRACED(state) \
- ((((struct i386_thread_state *) (state))->efl &= ~0x100), 1)
+ ((((struct i386_thread_state *) (state))->efl &= ~0x100), 1)
#endif /* __x86_64__ */
#endif /* GDB_CONFIG_I386_NM_X86_GNU_H */
diff --git a/gdb/configure b/gdb/configure
index 26fc9af..cc446c6 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -28818,7 +28818,7 @@ fi
-try_guile_versions="guile-3.0 guile-2.2 guile-2.0"
+try_guile_versions="guile-3.0 guile-2.2"
have_libguile=no
case "${with_guile}" in
no)
@@ -28886,14 +28886,6 @@ else
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- ac_fn_c_check_func "$LINENO" "scm_set_automatic_finalization_enabled" "ac_cv_func_scm_set_automatic_finalization_enabled"
-if test "x$ac_cv_func_scm_set_automatic_finalization_enabled" = xyes; then :
-
-$as_echo "#define HAVE_GUILE_MANUAL_FINALIZATION 1" >>confdefs.h
-
-
-fi
-
CPPFLAGS=$save_CPPFLAGS
LIBS=$save_LIBS
if test "${found_usable_guile}" = no; then
@@ -28970,14 +28962,6 @@ else
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- ac_fn_c_check_func "$LINENO" "scm_set_automatic_finalization_enabled" "ac_cv_func_scm_set_automatic_finalization_enabled"
-if test "x$ac_cv_func_scm_set_automatic_finalization_enabled" = xyes; then :
-
-$as_echo "#define HAVE_GUILE_MANUAL_FINALIZATION 1" >>confdefs.h
-
-
-fi
-
CPPFLAGS=$save_CPPFLAGS
LIBS=$save_LIBS
if test "${found_usable_guile}" = no; then
@@ -29051,14 +29035,6 @@ else
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- ac_fn_c_check_func "$LINENO" "scm_set_automatic_finalization_enabled" "ac_cv_func_scm_set_automatic_finalization_enabled"
-if test "x$ac_cv_func_scm_set_automatic_finalization_enabled" = xyes; then :
-
-$as_echo "#define HAVE_GUILE_MANUAL_FINALIZATION 1" >>confdefs.h
-
-
-fi
-
CPPFLAGS=$save_CPPFLAGS
LIBS=$save_LIBS
if test "${found_usable_guile}" = no; then
@@ -29078,7 +29054,7 @@ $as_echo "${found_usable_guile}" >&6; }
fi
;;
"" | */*)
- # Disallow --with=guile="" and --with-guile=foo/bar.
+ # Disallow --with-guile="" and --with-guile=foo/bar.
as_fn_error $? "invalid value for --with-guile" "$LINENO" 5
;;
*)
@@ -29142,14 +29118,6 @@ else
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- ac_fn_c_check_func "$LINENO" "scm_set_automatic_finalization_enabled" "ac_cv_func_scm_set_automatic_finalization_enabled"
-if test "x$ac_cv_func_scm_set_automatic_finalization_enabled" = xyes; then :
-
-$as_echo "#define HAVE_GUILE_MANUAL_FINALIZATION 1" >>confdefs.h
-
-
-fi
-
CPPFLAGS=$save_CPPFLAGS
LIBS=$save_LIBS
if test "${found_usable_guile}" = no; then
@@ -29177,16 +29145,6 @@ if ${ac_cv_guild_program_name+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_guild_program_name="`"${with_guile}" --variable guild "${guile_version}"`"
-
- # In Guile up to 2.0.11 included, guile-2.0.pc would not define
- # the 'guild' and 'bindir' variables. In that case, try to guess
- # what the program name is, at the risk of getting it wrong if
- # Guile was configured with '--program-suffix' or similar.
- if test "x$ac_cv_guild_program_name" = "x"; then
- guile_exec_prefix="`"${with_guile}" --variable exec_prefix "${guile_version}"`"
- ac_cv_guild_program_name="$guile_exec_prefix/bin/guild"
- fi
-
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_guild_program_name" >&5
$as_echo "$ac_cv_guild_program_name" >&6; }
@@ -29207,16 +29165,6 @@ if ${ac_cv_guild_program_name+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_guild_program_name="`"${pkg_config_prog_path}" --variable guild "${guile_version}"`"
-
- # In Guile up to 2.0.11 included, guile-2.0.pc would not define
- # the 'guild' and 'bindir' variables. In that case, try to guess
- # what the program name is, at the risk of getting it wrong if
- # Guile was configured with '--program-suffix' or similar.
- if test "x$ac_cv_guild_program_name" = "x"; then
- guile_exec_prefix="`"${pkg_config_prog_path}" --variable exec_prefix "${guile_version}"`"
- ac_cv_guild_program_name="$guile_exec_prefix/bin/guild"
- fi
-
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_guild_program_name" >&5
$as_echo "$ac_cv_guild_program_name" >&6; }
@@ -29272,24 +29220,6 @@ $as_echo "#define HAVE_GUILE 1" >>confdefs.h
CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_GUILE_SRCS)"
CONFIG_INSTALL="$CONFIG_INSTALL install-guile"
ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_GUILE_CFLAGS)"
-
- save_LIBS="$LIBS"
- save_CPPFLAGS="$CPPFLAGS"
- LIBS="$GUILE_LIBS"
- CPPFLAGS="$GUILE_CPPFLAGS"
- for ac_func in scm_new_smob
-do :
- ac_fn_c_check_func "$LINENO" "scm_new_smob" "ac_cv_func_scm_new_smob"
-if test "x$ac_cv_func_scm_new_smob" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_SCM_NEW_SMOB 1
-_ACEOF
-
-fi
-done
-
- LIBS="$save_LIBS"
- CPPFLAGS="$save_CPPFLAGS"
else
# Even if Guile support is not compiled in, we need to have these files
# included.
diff --git a/gdb/configure.ac b/gdb/configure.ac
index e1bbfdf..1b9939b 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1144,11 +1144,6 @@ AC_DEFUN([AC_TRY_LIBGUILE],
GUILE_CPPFLAGS=$new_CPPFLAGS
GUILE_LIBS=$new_LIBS],
[found_usable_guile=no])
- dnl scm_set_automatic_finalization_enabled added in Guile 2.2.
- AC_CHECK_FUNC(scm_set_automatic_finalization_enabled,
- AC_DEFINE(HAVE_GUILE_MANUAL_FINALIZATION, 1,
- [Define if Guile supports manual finalization.])
- )
CPPFLAGS=$save_CPPFLAGS
LIBS=$save_LIBS
if test "${found_usable_guile}" = no; then
@@ -1170,7 +1165,7 @@ dnl fall back to "no".
dnl guile-version [guile-version-choice-2 ...] -
dnl A space-separated list of guile package versions to try.
dnl These are passed to pkg-config as-is.
-dnl E.g., guile-2.0 or guile-2.2-uninstalled
+dnl E.g., guile-3.0 or guile-2.2-uninstalled
dnl This requires making sure PKG_CONFIG_PATH is set appropriately.
dnl /path/to/pkg-config -
dnl Use this pkg-config program.
@@ -1192,7 +1187,7 @@ AC_MSG_RESULT([$with_guile])
dnl We check guile with pkg-config.
AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing)
-try_guile_versions="guile-3.0 guile-2.2 guile-2.0"
+try_guile_versions="guile-3.0 guile-2.2"
have_libguile=no
case "${with_guile}" in
no)
@@ -1219,7 +1214,7 @@ yes)
fi
;;
"" | */*)
- # Disallow --with=guile="" and --with-guile=foo/bar.
+ # Disallow --with-guile="" and --with-guile=foo/bar.
AC_MSG_ERROR([invalid value for --with-guile])
;;
*)
@@ -1258,15 +1253,6 @@ if test "${have_libguile}" != no; then
CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_GUILE_SRCS)"
CONFIG_INSTALL="$CONFIG_INSTALL install-guile"
ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_GUILE_CFLAGS)"
-
- dnl The 'scm_new_smob' function appeared in Guile 2.0.6.
- save_LIBS="$LIBS"
- save_CPPFLAGS="$CPPFLAGS"
- LIBS="$GUILE_LIBS"
- CPPFLAGS="$GUILE_CPPFLAGS"
- AC_CHECK_FUNCS([scm_new_smob])
- LIBS="$save_LIBS"
- CPPFLAGS="$save_CPPFLAGS"
else
# Even if Guile support is not compiled in, we need to have these files
# included.
diff --git a/gdb/contrib/check-whitespace-pre-commit.py b/gdb/contrib/check-whitespace-pre-commit.py
new file mode 100755
index 0000000..9d82f77
--- /dev/null
+++ b/gdb/contrib/check-whitespace-pre-commit.py
@@ -0,0 +1,52 @@
+#! /usr/bin/env python3
+
+# Copyright (C) 2025 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import re
+import subprocess
+import sys
+
+re_clean = re.compile(
+ "(^(gdb/testsuite/|gdbsupport/|gdbserver/)|[.](m4|ac|def|[chly])$|NEWS)"
+)
+re_clean_exclude = re.compile("^(gdb/symfile.c|gdb/cli/cli-cmds.c)$")
+
+clean = []
+other = []
+for f in sys.argv[1:]:
+ m = re_clean.search(f)
+ if m and re_clean_exclude.search(f):
+ m = None
+ if m:
+ clean.append(f)
+ else:
+ other.append(f)
+
+if other:
+ cmd = ["git", "--no-pager", "diff", "--staged", "--check"] + other
+ res = subprocess.run(cmd)
+ if res.returncode != 0:
+ sys.exit(res.returncode)
+
+if clean:
+ cmd = ["git", "hash-object", "-t", "tree", "/dev/null"]
+ res = subprocess.run(cmd, capture_output=True, text=True)
+ if res.returncode != 0:
+ sys.exit(res.returncode)
+ null_tree = res.stdout.rstrip("\n")
+
+ cmd = ["git", "diff-index", "--cached", "--check", null_tree] + clean
+ res = subprocess.run(cmd)
+ sys.exit(res.returncode)
diff --git a/gdb/contrib/check-whitespace-pre-commit.sh b/gdb/contrib/check-whitespace-pre-commit.sh
deleted file mode 100755
index db45dc2..0000000
--- a/gdb/contrib/check-whitespace-pre-commit.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2025 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-git --no-pager diff --staged --check "$@"
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index 7221b78..f7b8828 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -946,7 +946,7 @@ declarator_1 : ptr_operator declarator_1
| direct_declarator_1
/* Function local variable or type. The typespec to
- our left is the type of the containing function.
+ our left is the type of the containing function.
This should be OK, because function local types
can not be templates, so the return types of their
members will not be mangled. If they are hopefully
@@ -1163,7 +1163,7 @@ exp : exp '?' exp ':' exp %prec '?'
state->fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG2, $3, $5)));
}
;
-
+
exp : INT
;
@@ -1180,7 +1180,7 @@ exp : SIZEOF '(' type ')' %prec UNARY
;
/* C++. */
-exp : TRUEKEYWORD
+exp : TRUEKEYWORD
{ struct demangle_component *i;
i = state->make_name ("1", 1);
$$ = state->fill_comp (DEMANGLE_COMPONENT_LITERAL,
@@ -1189,7 +1189,7 @@ exp : TRUEKEYWORD
}
;
-exp : FALSEKEYWORD
+exp : FALSEKEYWORD
{ struct demangle_component *i;
i = state->make_name ("0", 1);
$$ = state->fill_comp (DEMANGLE_COMPONENT_LITERAL,
@@ -1364,10 +1364,10 @@ cpname_state::parse_number (const char *p, int len, int parsed_float,
c = c_tolower (p[len - 1]);
if (c == 'f')
- {
- len--;
- type = make_builtin_type ("float");
- }
+ {
+ len--;
+ type = make_builtin_type ("float");
+ }
else if (c == 'l')
{
len--;
@@ -1589,7 +1589,7 @@ cp_parse_escape (const char **string_ptr)
state->lexptr += 2; \
lvalp->opname = string; \
return token; \
- }
+ }
#define HANDLE_TOKEN3(string, token) \
if (state->lexptr[1] == string[1] && state->lexptr[2] == string[2]) \
@@ -1597,7 +1597,7 @@ cp_parse_escape (const char **string_ptr)
state->lexptr += 3; \
lvalp->opname = string; \
return token; \
- }
+ }
/* Read one token, getting characters through LEXPTR. */
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index e774dee..f6b5629 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -1629,4 +1629,3 @@ yyerror (const char *msg)
{
pstate->parse_error (msg);
}
-
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index b5e046e..3fa2896 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -516,4 +516,3 @@ d_lookup_symbol_nonlocal (const struct language_defn *langdef,
return d_lookup_symbol_module (scope, name, block, domain);
}
-
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index 38ace30..f4a9614 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -549,7 +549,7 @@ darwin_debug_regions (task_t task, mach_vm_address_t address, int max)
count = VM_REGION_BASIC_INFO_COUNT_64;
kret =
mach_vm_region (task, &address, &size, VM_REGION_BASIC_INFO_64,
- (vm_region_info_t) &info, &count, &object_name);
+ (vm_region_info_t) &info, &count, &object_name);
if (kret != KERN_SUCCESS)
{
size = 0;
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e446922..bd5d025 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -29585,6 +29585,32 @@ Continuing.
Suppressing CLI notifications may be useful in scripts to obtain a
reduced output from a list of commands.
+
+@kindex show local-environment
+@item show local-environment @r{[}@var{varname}@r{]}
+Print the value of the local environment variable @var{varname}. If
+you do not supply @var{varname}, print the names and values of all
+local environment variables. A local environment variable is used
+when @value{GDBN} executes a local command, such as by the
+@code{shell} command.
+
+@kindex set local-environment
+@anchor{set local-environment}
+@item set local-environment @var{varname} @r{[}=@var{value}@r{]}
+Set environment variable @var{varname} to @var{value}. The value
+changes for @value{GDBN} itself. The @var{value} may be any string;
+the values of environment variables are just strings, and any
+interpretation is supplied by your program itself. The @var{value}
+parameter is optional; if it is eliminated, the variable is set to a
+null value.
+
+@kindex unset local-environment
+@anchor{unset local-environment}
+@item unset local-environment @var{varname}
+Remove variable @var{varname} from the local environment. This is
+different from @samp{set local-environment @var{varname} =};
+@code{unset local-environment} removes the variable from the
+environment, rather than assigning it an empty value.
@end table
@kindex show suppress-cli-notifications
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index fcedef0..83ea3e0 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -38,7 +38,7 @@ Guile support in @value{GDBN} follows the Python support in @value{GDBN}
reasonably closely, so concepts there should carry over.
However, some things are done differently where it makes sense.
-@value{GDBN} requires Guile version 3.0, 2.2, or 2.0.
+@value{GDBN} requires Guile version 3.0, 2.2.
@cindex guile scripts directory
Guile scripts used by @value{GDBN} should be installed in
diff --git a/gdb/dwarf2/abbrev.h b/gdb/dwarf2/abbrev.h
index a36bb8c..6994e7f 100644
--- a/gdb/dwarf2/abbrev.h
+++ b/gdb/dwarf2/abbrev.h
@@ -145,7 +145,7 @@ private:
/* Hash table of abbrev, identified by their number. */
gdb::unordered_set<const abbrev_info *,
- abbrev_info_number_hash,
+ abbrev_info_number_hash,
abbrev_info_number_eq>
m_abbrevs;
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index ecda7a6..5fe1884 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -1867,21 +1867,19 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
std::vector<const gdb_byte *> ops_to_visit;
/* Operations already visited. */
- gdb::unordered_set<const gdb_byte *> visited_ops;
+ std::vector<bool> visited_ops (expr.size (), false);
/* Insert OP in OPS_TO_VISIT if it is within the expression's range and
hasn't been visited yet. */
- auto insert_in_ops_to_visit
- = [expr_end, &visited_ops, &ops_to_visit] (const gdb_byte *op_ptr)
- {
- if (op_ptr >= expr_end)
- return;
+ auto insert_in_ops_to_visit = [&] (const gdb_byte *op_ptr)
+ {
+ size_t off = op_ptr - expr.data ();
- if (visited_ops.find (op_ptr) != visited_ops.end ())
- return;
+ if (off >= expr.size () || visited_ops[off])
+ return;
- ops_to_visit.push_back (op_ptr);
- };
+ ops_to_visit.push_back (op_ptr);
+ };
/* Expressions can invoke other expressions with DW_OP_call*. Protect against
a loop of calls. */
@@ -1892,17 +1890,24 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
depth++;
- /* Initialize the to-visit list with the first operation. */
- insert_in_ops_to_visit (&expr[0]);
-
- while (!ops_to_visit.empty ())
+ const gdb_byte *op_ptr = &expr[0];
+ while (op_ptr != nullptr || !ops_to_visit.empty ())
{
- /* Pop one op to visit, mark it as visited. */
- const gdb_byte *op_ptr = ops_to_visit.back ();
- ops_to_visit.pop_back ();
- if (visited_ops.find (op_ptr) != visited_ops.end ())
- continue;
- visited_ops.insert (op_ptr);
+ /* If the previous operation fell through, just keep going.
+ Otherwise pop the next op to visit. */
+ if (op_ptr == nullptr)
+ {
+ op_ptr = ops_to_visit.back ();
+ ops_to_visit.pop_back ();
+ }
+
+ size_t pc = op_ptr - expr.data ();
+ if (visited_ops[pc])
+ {
+ op_ptr = nullptr;
+ continue;
+ }
+ visited_ops[pc] = true;
dwarf_location_atom op = (dwarf_location_atom) *op_ptr;
@@ -2153,8 +2158,7 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
op_ptr += 2;
insert_in_ops_to_visit (op_ptr + offset);
- insert_in_ops_to_visit (op_ptr);
- continue;
+ break;
}
case DW_OP_call2:
@@ -2267,7 +2271,9 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
if (symbol_needs == SYMBOL_NEEDS_FRAME)
break;
- insert_in_ops_to_visit (op_ptr);
+ /* Don't run off the end. */
+ if (op_ptr >= expr_end)
+ op_ptr = nullptr;
}
return symbol_needs;
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index a8ee9a3..aed6e47 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -20,8 +20,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/>. */
-/* This was blantantly ripped off the C expression parser, please
- be aware of that as you look at its basic structure -FMB */
+/* This was blantantly ripped off the C expression parser, please
+ be aware of that as you look at its basic structure -FMB */
/* Parse a F77 expression from text in a string,
and return the result as a struct expression pointer.
@@ -39,7 +39,7 @@
with include files (<malloc.h> and <stdlib.h> for example) just became
too messy, particularly when such includes can be inserted at random
times by the parser generator. */
-
+
%{
#include "expression.h"
@@ -134,7 +134,7 @@ static int parse_number (struct parser_state *, const char *, int,
int, YYSTYPE *);
%}
-%type <voidval> exp type_exp start variable
+%type <voidval> exp type_exp start variable
%type <tval> type typebase
%type <tvec> nonempty_typelist
/* %type <bval> block */
@@ -156,7 +156,7 @@ static int parse_number (struct parser_state *, const char *, int,
%token <sval> STRING_LITERAL
%token <lval> BOOLEAN_LITERAL
-%token <ssym> NAME
+%token <ssym> NAME
%token <tsym> TYPENAME
%token <voidval> COMPLETE
%type <sval> name
@@ -167,7 +167,7 @@ static int parse_number (struct parser_state *, const char *, int,
E.g. "c" when input_radix==16. Depending on the parse, it will be
turned into a name or into a number. */
-%token <ssym> NAME_OR_INT
+%token <ssym> NAME_OR_INT
%token SIZEOF KIND
%token ERROR
@@ -180,9 +180,9 @@ static int parse_number (struct parser_state *, const char *, int,
%token REAL_KEYWORD REAL_S4_KEYWORD REAL_S8_KEYWORD REAL_S16_KEYWORD
%token COMPLEX_KEYWORD COMPLEX_S4_KEYWORD COMPLEX_S8_KEYWORD
%token COMPLEX_S16_KEYWORD
-%token BOOL_AND BOOL_OR BOOL_NOT
+%token BOOL_AND BOOL_OR BOOL_NOT
%token SINGLE DOUBLE PRECISION
-%token <lval> CHARACTER
+%token <lval> CHARACTER
%token <sval> DOLLAR_VARIABLE
@@ -208,7 +208,7 @@ static int parse_number (struct parser_state *, const char *, int,
%left '*' '/'
%right STARSTAR
%right '%'
-%right UNARY
+%right UNARY
%right '('
@@ -255,14 +255,14 @@ exp : KIND '(' exp ')' %prec UNARY
{ pstate->wrap<fortran_kind_operation> (); }
;
-/* No more explicit array operators, we treat everything in F77 as
- a function call. The disambiguation as to whether we are
- doing a subscript operation or a function call is done
+/* No more explicit array operators, we treat everything in F77 as
+ a function call. The disambiguation as to whether we are
+ doing a subscript operation or a function call is done
later in eval.c. */
-exp : exp '('
+exp : exp '('
{ pstate->start_arglist (); }
- arglist ')'
+ arglist ')'
{
std::vector<operation_up> args
= pstate->pop_vector (pstate->end_arglist ());
@@ -337,7 +337,7 @@ arglist : exp
arglist : subrange
{ pstate->arglist_len = 1; }
;
-
+
arglist : arglist ',' exp %prec ABOVE_COMMA
{ pstate->arglist_len++; }
;
@@ -435,8 +435,8 @@ subrange: ':' ':' exp %prec ABOVE_COMMA
}
;
-complexnum: exp ',' exp
- { }
+complexnum: exp ',' exp
+ { }
;
exp : '(' complexnum ')'
@@ -647,7 +647,7 @@ ptype : typebase
int array_size;
struct type *follow_type = $1;
struct type *range_type;
-
+
while (!done)
switch (type_stack->pop ())
{
@@ -734,9 +734,9 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
{ $$ = parse_f_type (pstate)->builtin_integer; }
| INT_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_integer_s8; }
- | CHARACTER
+ | CHARACTER
{ $$ = parse_f_type (pstate)->builtin_character; }
- | LOGICAL_S1_KEYWORD
+ | LOGICAL_S1_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_logical_s1; }
| LOGICAL_S2_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_logical_s2; }
@@ -746,7 +746,7 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
{ $$ = parse_f_type (pstate)->builtin_logical; }
| LOGICAL_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_logical_s8; }
- | REAL_KEYWORD
+ | REAL_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_real; }
| REAL_S4_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_real; }
@@ -764,7 +764,7 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
{ $$ = parse_f_type (pstate)->builtin_complex; }
| COMPLEX_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s8; }
- | COMPLEX_S16_KEYWORD
+ | COMPLEX_S16_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s16;
if ($$->code () == TYPE_CODE_ERROR)
error (_("unsupported type %s"),
@@ -806,7 +806,7 @@ name_not_typename : NAME
the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
=exp) or just an exp. If name_not_typename was ever used in an lvalue
context where only a name could occur, this might be useful.
- | NAME_OR_INT
+ | NAME_OR_INT
*/
;
@@ -1039,7 +1039,7 @@ parse_number (struct parser_state *par_state,
len -= 2;
}
break;
-
+
case 't':
case 'T':
case 'd':
@@ -1051,12 +1051,12 @@ parse_number (struct parser_state *par_state,
len -= 2;
}
break;
-
+
default:
base = 8;
break;
}
-
+
while (len-- > 0)
{
c = *p++;
@@ -1087,12 +1087,12 @@ parse_number (struct parser_state *par_state,
range_error (_("Overflow on numeric constant."));
prevn = n;
}
-
+
/* If the number is too big to be an int, or it's got an l suffix
then it's a long. Work out if this has to be a long by
shifting right and seeing if anything remains, and the
target int size is different to the target long size.
-
+
In the expression below, we could have tested
(n >> gdbarch_int_bit (parse_gdbarch))
to see if it was zero,
@@ -1112,28 +1112,28 @@ parse_number (struct parser_state *par_state,
unsigned_type = parse_type (par_state)->builtin_unsigned_long;
signed_type = parse_type (par_state)->builtin_long;
}
- else
+ else
{
bits_available = gdbarch_int_bit (par_state->gdbarch ());
unsigned_type = parse_type (par_state)->builtin_unsigned_int;
signed_type = parse_type (par_state)->builtin_int;
- }
+ }
high_bit = ((ULONGEST)1) << (bits_available - 1);
-
+
if (RANGE_CHECK
&& ((n >> 2) >> (bits_available - 2)))
range_error (_("Overflow on numeric constant."));
putithere->typed_val.val = n;
-
+
/* If the high bit of the worked out type is set then this number
has to be unsigned. */
-
- if (unsigned_p || (n & high_bit))
+
+ if (unsigned_p || (n & high_bit))
putithere->typed_val.type = unsigned_type;
- else
+ else
putithere->typed_val.type = signed_type;
-
+
return INT;
}
@@ -1343,7 +1343,7 @@ static const f_token f_keywords[] =
/* Implementation of a dynamically expandable buffer for processing input
characters acquired through lexptr and building a value to return in
- yylval. Ripped off from ch-exp.y */
+ yylval. Ripped off from ch-exp.y */
static char *tempbuf; /* Current buffer contents */
static int tempbufsize; /* Size of allocated buffer */
@@ -1376,9 +1376,9 @@ growbuf_by_size (int count)
tempbuf = (char *) realloc (tempbuf, tempbufsize);
}
-/* Blatantly ripped off from ch-exp.y. This routine recognizes F77
+/* Blatantly ripped off from ch-exp.y. This routine recognizes F77
string-literals.
-
+
Recognize a string literal. A string literal is a nonzero sequence
of characters enclosed in matching single quotes, except that
a single character inside single quotes is a character literal, which
@@ -1438,9 +1438,9 @@ yylex (void)
last_was_structop = false;
retry:
-
+
pstate->prev_lexptr = pstate->lexptr;
-
+
tokstart = pstate->lexptr;
/* First of all, let us make sure we are not dealing with the
@@ -1482,43 +1482,43 @@ yylex (void)
else if (pstate->parse_completion && saw_structop)
return COMPLETE;
return 0;
-
+
case ' ':
case '\t':
case '\n':
pstate->lexptr++;
goto retry;
-
+
case '\'':
token = match_string_literal ();
if (token != 0)
return (token);
break;
-
+
case '(':
paren_depth++;
pstate->lexptr++;
return c;
-
+
case ')':
if (paren_depth == 0)
return 0;
paren_depth--;
pstate->lexptr++;
return c;
-
+
case ',':
if (pstate->comma_terminates && paren_depth == 0)
return 0;
pstate->lexptr++;
return c;
-
+
case '.':
/* Might be a floating point number. */
if (pstate->lexptr[1] < '0' || pstate->lexptr[1] > '9')
goto symbol; /* Nope, must be a symbol. */
[[fallthrough]];
-
+
case '0':
case '1':
case '2':
@@ -1534,7 +1534,7 @@ yylex (void)
int got_dot = 0, got_e = 0, got_d = 0, toktype;
const char *p = tokstart;
int hex = input_radix > 10;
-
+
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
{
p += 2;
@@ -1546,7 +1546,7 @@ yylex (void)
p += 2;
hex = 0;
}
-
+
for (;; ++p)
{
if (!hex && !got_e && (*p == 'e' || *p == 'E'))
@@ -1604,26 +1604,26 @@ yylex (void)
pstate->lexptr++;
return c;
}
-
+
if (!(c == '_' || c == '$' || c ==':'
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
/* We must have come across a bad character (e.g. ';'). */
error (_("Invalid character '%c' in expression."), c);
-
+
namelen = 0;
for (c = tokstart[namelen];
(c == '_' || c == '$' || c == ':' || (c >= '0' && c <= '9')
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
+ || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
c = tokstart[++namelen]);
-
- /* The token "if" terminates the expression and is NOT
+
+ /* The token "if" terminates the expression and is NOT
removed from the input stream. */
-
+
if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
return 0;
-
+
pstate->lexptr += namelen;
-
+
/* Catch specific keywords. */
for (const auto &keyword : f_keywords)
@@ -1639,7 +1639,7 @@ yylex (void)
yylval.sval.ptr = tokstart;
yylval.sval.length = namelen;
-
+
if (*tokstart == '$')
return DOLLAR_VARIABLE;
@@ -1699,7 +1699,7 @@ yylex (void)
&& ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
{
- YYSTYPE newlval; /* Its value is ignored. */
+ YYSTYPE newlval; /* Its value is ignored. */
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
if (hextype == INT)
{
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index 60a8bf3..aeef77a 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -156,18 +156,6 @@ struct scheme_integer_constant
#define gdbscm_is_false(scm) scm_is_eq ((scm), SCM_BOOL_F)
#define gdbscm_is_true(scm) (!gdbscm_is_false (scm))
-#ifndef HAVE_SCM_NEW_SMOB
-
-/* Guile <= 2.0.5 did not provide this function, so provide it here. */
-
-static inline SCM
-scm_new_smob (scm_t_bits tc, scm_t_bits data)
-{
- SCM_RETURN_NEWSMOB (tc, data);
-}
-
-#endif
-
/* Function name that is passed around in case an error needs to be reported.
__func is in C99, but we provide a wrapper "just in case",
and because FUNC_NAME is the canonical value used in guile sources.
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 66a74b3..bbeea9c 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -633,9 +633,7 @@ call_initialize_gdb_module (void *data)
performed within the desired module. */
scm_c_define_module (gdbscm_module_name, initialize_gdb_module, NULL);
-#if HAVE_GUILE_MANUAL_FINALIZATION
scm_run_finalizers ();
-#endif
return NULL;
}
@@ -651,12 +649,10 @@ gdbscm_initialize (const struct extension_language_defn *extlang)
Python side to define module "gdb" which imports "_gdb". There is
evidently no similar convention in Guile so we skip this. */
-#if HAVE_GUILE_MANUAL_FINALIZATION
/* Our SMOB free functions are not thread-safe, as GDB itself is not
intended to be thread-safe. Disable automatic finalization so that
finalizers aren't run in other threads. */
scm_set_automatic_finalization_enabled (0);
-#endif
/* Before we initialize Guile, block signals needed by gdb (especially
SIGCHLD). This is done so that all threads created during Guile
diff --git a/gdb/guile/scm-safe-call.c b/gdb/guile/scm-safe-call.c
index 95dcf3a..3023eb4 100644
--- a/gdb/guile/scm-safe-call.c
+++ b/gdb/guile/scm-safe-call.c
@@ -155,9 +155,7 @@ gdbscm_with_catch (void *data)
d->unwind_handler, d,
d->pre_unwind_handler, d);
-#if HAVE_GUILE_MANUAL_FINALIZATION
scm_run_finalizers ();
-#endif
return NULL;
}
diff --git a/gdb/i386-syscalls.def b/gdb/i386-syscalls.def
index 5ba384a..40e8db9 100644
--- a/gdb/i386-syscalls.def
+++ b/gdb/i386-syscalls.def
@@ -18,7 +18,7 @@
Generated using linux v6.13 and command:
$ egrep -v "^#.*" ./arch/x86/entry/syscalls/syscall_32.tbl \
- | awk '{printf "SYSCALL (%s, %s)\n", $1, $3}'
+ | awk '{printf "SYSCALL (%s, %s)\n", $1, $3}'
*/
SYSCALL (0, restart_syscall)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 60f7969..3ba2867 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1998,12 +1998,18 @@ info_program_command (const char *args, int from_tty)
styled_string (command_style.style (), "info registers"));
}
+
+/* A helper function that prints some info from ENV. If ENV is
+ nullptr, then the host environment is used; otherwise the provided
+ environment is used. VAR is either NULL, or the name of the
+ variable to display. */
+
static void
-environment_info (const char *var, int from_tty)
+display_environment (const gdb_environ *env, const char *var)
{
if (var)
{
- const char *val = current_inferior ()->environment.get (var);
+ const char *val = env == nullptr ? getenv (var) : env->get (var);
if (val)
{
@@ -2021,7 +2027,9 @@ environment_info (const char *var, int from_tty)
}
else
{
- char **envp = current_inferior ()->environment.envp ();
+ char **envp = env == nullptr ? environ : env->envp ();
+ if (envp == nullptr)
+ return;
for (int idx = 0; envp[idx] != nullptr; ++idx)
{
@@ -2032,7 +2040,23 @@ environment_info (const char *var, int from_tty)
}
static void
-set_environment_command (const char *arg, int from_tty)
+environment_info (const char *var, int from_tty)
+{
+ display_environment (&current_inferior ()->environment, var);
+}
+
+static void
+local_environment_info (const char *var, int from_tty)
+{
+ display_environment (nullptr, var);
+}
+
+/* A helper to set an environment variable. ARG is the string passed
+ to 'set environment', i.e., the variable and value to use. ENV is
+ the environment in which the variable will be set. */
+
+static void
+set_var_in_environment (gdb_environ *env, const char *arg)
{
const char *p, *val;
int nullset = 0;
@@ -2087,24 +2111,70 @@ set_environment_command (const char *arg, int from_tty)
gdb_printf (_("Setting environment variable "
"\"%s\" to null value.\n"),
var.c_str ());
- current_inferior ()->environment.set (var.c_str (), "");
+ if (env == nullptr)
+ setenv (var.c_str (), "", 1);
+ else
+ env->set (var.c_str (), "");
}
else
- current_inferior ()->environment.set (var.c_str (), val);
+ {
+ if (env == nullptr)
+ setenv (var.c_str (), val, 1);
+ else
+ env->set (var.c_str (), val);
+ }
}
static void
-unset_environment_command (const char *var, int from_tty)
+set_environment_command (const char *arg, int from_tty)
+{
+ set_var_in_environment (&current_inferior ()->environment, arg);
+}
+
+static void
+set_local_environment_command (const char *arg, int from_tty)
+{
+ set_var_in_environment (nullptr, arg);
+}
+
+/* A helper to unset an environment variable. ENV is the environment
+ in which the variable will be unset. VAR is the name of the
+ variable, or NULL meaning unset all variables. */
+
+static void
+unset_var_in_environment (gdb_environ *env, const char *var, int from_tty)
{
if (var == 0)
{
/* If there is no argument, delete all environment variables.
Ask for confirmation if reading from the terminal. */
if (!from_tty || query (_("Delete all environment variables? ")))
- current_inferior ()->environment.clear ();
+ {
+ if (env == nullptr)
+ clearenv ();
+ else
+ env->clear ();
+ }
}
else
- current_inferior ()->environment.unset (var);
+ {
+ if (env == nullptr)
+ unsetenv (var);
+ else
+ env->unset (var);
+ }
+}
+
+static void
+unset_environment_command (const char *var, int from_tty)
+{
+ unset_var_in_environment (&current_inferior ()->environment, var, from_tty);
+}
+
+static void
+unset_local_environment_command (const char *var, int from_tty)
+{
+ unset_var_in_environment (nullptr, var, from_tty);
}
/* Handle the execution path (PATH variable). */
@@ -3132,6 +3202,14 @@ give the program being debugged. With no arguments, prints the entire\n\
environment to be given to the program."), &showlist);
set_cmd_completer (c, noop_completer);
+ c = add_cmd ("local-environment", no_class, local_environment_info, _("\
+The local environment, or one variable's value.\n\
+With an argument VAR, prints the value of environment variable VAR to\n\
+use locally. With no arguments, prints the entire local environment.\n\
+The local environment by commands that run a process locally, for\n\
+example \"shell\"."), &showlist);
+ set_cmd_completer (c, noop_completer);
+
add_basic_prefix_cmd ("unset", no_class,
_("Complement to certain \"set\" commands."),
&unsetlist, 0, &cmdlist);
@@ -3142,6 +3220,12 @@ This does not affect the program until the next \"run\" command."),
&unsetlist);
set_cmd_completer (c, noop_completer);
+ c = add_cmd ("local-environment", class_run,
+ unset_local_environment_command, _("\
+Cancel local environment variable VAR."),
+ &unsetlist);
+ set_cmd_completer (c, noop_completer);
+
c = add_cmd ("environment", class_run, set_environment_command, _("\
Set environment variable value to give the program.\n\
Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
@@ -3150,6 +3234,16 @@ This does not affect the program until the next \"run\" command."),
&setlist);
set_cmd_completer (c, noop_completer);
+ c = add_cmd ("local-environment", class_run,
+ set_local_environment_command, _("\
+Set local environment variable value.\n\
+Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
+VALUES of environment variables are uninterpreted strings.\n\
+The local environment by commands that run a process locally, for\n\
+example \"shell\"."),
+ &setlist);
+ set_cmd_completer (c, noop_completer);
+
c = add_com ("path", class_files, path_command, _("\
Add directory DIR(s) to beginning of search path for object files.\n\
$cwd in the path means the current working directory.\n\
diff --git a/gdb/jit.c b/gdb/jit.c
index b2b0800..5123717 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -553,7 +553,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
}
auto bv = std::make_unique<blockvector> (actual_nblocks);
-
+
/* At the end of this function, (begin, end) will contain the PC range this
entire blockvector spans. */
begin = stab->blocks.front ().begin;
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 277b45b..2cbfe2f 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1071,11 +1071,16 @@ add_sal_to_sals (struct linespec_state *self,
const symtab_and_line &sal,
const char *symname, bool literal_canonical)
{
- /* We don't want two SALs with the same PC from the
- same program space. */
- for (const auto &s : sals)
- if (sal.pc == s.pc && sal.pspace == s.pspace)
- return;
+ /* We don't want two SALs with the same PC from the same program space.
+ However, for the 'list' command we force the pc value to be 0, and in
+ this case we do want to see all SALs. See decode_digits_list_mode
+ for where the 0 originates from. */
+ if (sal.pc != 0)
+ {
+ for (const auto &s : sals)
+ if (sal.pc == s.pc && sal.pspace == s.pspace)
+ return;
+ }
sals.push_back (sal);
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 1084361..8fadc75 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -291,7 +291,7 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
type_allocator alloc (gdbarch);
int_type = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
- 0, "int");
+ 0, "int");
uint_type = init_integer_type (alloc, gdbarch_int_bit (gdbarch),
1, "unsigned int");
long_type = init_integer_type (alloc, gdbarch_long_bit (gdbarch),
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 55d5f2e..c72cdf6 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -34,7 +34,7 @@
with include files (<malloc.h> and <stdlib.h> for example) just became
too messy, particularly when such includes can be inserted at random
times by the parser generator. */
-
+
%{
#include "expression.h"
@@ -96,8 +96,8 @@ using namespace expr;
%type <voidval> exp type_exp start set
%type <voidval> variable
%type <tval> type
-%type <bval> block
-%type <sym> fblock
+%type <bval> block
+%type <sym> fblock
%token <lval> INT HEX ERROR
%token <ulval> UINT M2_TRUE M2_FALSE CHAR
@@ -139,7 +139,7 @@ using namespace expr;
%right '^' DOT '[' '('
%right NOT '~'
%left COLONCOLON QID
-/* This is not an actual token ; it is used for precedence.
+/* This is not an actual token ; it is used for precedence.
%right QID
*/
@@ -338,8 +338,8 @@ non_empty_arglist
non_empty_arglist
: non_empty_arglist ',' exp %prec ABOVE_COMMA
- { pstate->arglist_len++; }
- ;
+ { pstate->arglist_len++; }
+ ;
/* GDB construct */
exp : '{' type '}' exp %prec UNARY
@@ -489,7 +489,7 @@ exp : STRING
;
/* This will be used for extensions later. Like adding modules. */
-block : fblock
+block : fblock
{ $$ = $1->value_block (); }
;
@@ -500,7 +500,7 @@ fblock : BLOCKNAME
SEARCH_VFT, 0).symbol;
$$ = sym;}
;
-
+
/* GDB scope operator */
fblock : block COLONCOLON BLOCKNAME
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 55b26f9..2aa2cd8 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -1532,4 +1532,3 @@ INIT_GDB_FILE (m68hc11_tdep)
gdbarch_register (bfd_arch_m68hc12, m68hc11_gdbarch_init);
m68hc11_init_reggroups ();
}
-
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index e7c526a..f5949e61 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -109,8 +109,8 @@ struct md_symloc
#define SC_IS_TEXT(sc) ((sc) == scText \
|| (sc) == scRConst \
- || (sc) == scInit \
- || (sc) == scFini)
+ || (sc) == scInit \
+ || (sc) == scFini)
#define SC_IS_DATA(sc) ((sc) == scData \
|| (sc) == scSData \
|| (sc) == scRData \
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 2c9295d..742b1cb 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -594,4 +594,3 @@ mi_cmd_break_commands (const char *command, const char *const *argv, int argc)
breakpoint_set_commands (b, std::move (break_command));
}
-
diff --git a/gdb/mi/mi-cmd-catch.c b/gdb/mi/mi-cmd-catch.c
index 8c0d230..00beff7 100644
--- a/gdb/mi/mi-cmd-catch.c
+++ b/gdb/mi/mi-cmd-catch.c
@@ -358,4 +358,3 @@ mi_cmd_catch_catch (const char *cmd, const char *const *argv, int argc)
{
mi_cmd_catch_exception_event (EX_EVENT_CATCH, cmd, argv, argc);
}
-
diff --git a/gdb/mi/mi-cmd-target.c b/gdb/mi/mi-cmd-target.c
index 22bc43e..c3de8a9 100644
--- a/gdb/mi/mi-cmd-target.c
+++ b/gdb/mi/mi-cmd-target.c
@@ -91,4 +91,3 @@ mi_cmd_target_file_delete (const char *command, const char *const *argv,
remote_file_delete (remote_file, 0);
}
-
diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
index e672ad3..64c1544 100644
--- a/gdb/mn10300-linux-tdep.c
+++ b/gdb/mn10300-linux-tdep.c
@@ -719,4 +719,3 @@ INIT_GDB_FILE (mn10300_linux_tdep)
gdbarch_register_osabi (bfd_arch_mn10300, 0,
GDB_OSABI_LINUX, am33_linux_init_osabi);
}
-
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index e6e7f3d..f0167d9 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1417,4 +1417,3 @@ INIT_GDB_FILE (mn10300_tdep)
{
gdbarch_register (bfd_arch_mn10300, mn10300_gdbarch_init, mn10300_dump_tdep);
}
-
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index a68443a..ff84e77 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -540,8 +540,8 @@ exp : DOLLAR_VARIABLE
intvar);
current_type = val->type ();
}
- }
- ;
+ }
+ ;
exp : SIZEOF '(' type ')' %prec UNARY
{
@@ -782,7 +782,7 @@ name_not_typename : NAME
the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
=exp) or just an exp. If name_not_typename was ever used in an lvalue
context where only a name could occur, this might be useful.
- | NAME_OR_INT
+ | NAME_OR_INT
*/
;
@@ -1408,7 +1408,7 @@ yylex (void)
{
yylval.lval = 1;
free (uptokstart);
- return TRUEKEYWORD;
+ return TRUEKEYWORD;
}
if (strcmp (uptokstart, "SELF") == 0)
{
@@ -1637,7 +1637,7 @@ yylex (void)
&& ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
{
- YYSTYPE newlval; /* Its value is ignored. */
+ YYSTYPE newlval; /* Its value is ignored. */
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
if (hextype == INT)
{
diff --git a/gdb/po/gdbtext b/gdb/po/gdbtext
index b35c665..37cd6dd 100755
--- a/gdb/po/gdbtext
+++ b/gdb/po/gdbtext
@@ -22,7 +22,8 @@ do
-name '*-stub.c' -prune -o \
-name 'testsuite' -prune -o \
-name 'init.c' -prune -o \
- -name '*.[hc]' -o -name '*.cc' -print
+ -name '*.[hc]' -print -o \
+ -name '*.cc' -print
)
done | ${xgettext} \
--default-domain=${package} \
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index cc300cd..3f20cf3 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1705,7 +1705,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
ppc64_sysv_abi_push_param (gdbarch, eltype, val, &argpos);
ppc64_sysv_abi_push_param (gdbarch, eltype,
- val + eltype->length (), &argpos);
+ val + eltype->length (), &argpos);
}
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
&& opencl_abi)
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 366235f..feca5b0 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -1428,4 +1428,3 @@ INIT_GDB_FILE (rs6000_aix_tdep)
gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_AIX,
rs6000_aix_init_osabi);
}
-
diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c
index d0d9a53..6e7b3db 100644
--- a/gdb/rs6000-lynx178-tdep.c
+++ b/gdb/rs6000-lynx178-tdep.c
@@ -415,4 +415,3 @@ INIT_GDB_FILE (rs6000_lynx178_tdep)
gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_LYNXOS178,
rs6000_lynx178_init_osabi);
}
-
diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
index af7eff2..d97ab25 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -20,7 +20,6 @@
#include "amd-dbgapi-target.h"
#include "amdgpu-tdep.h"
-#include "arch-utils.h"
#include "elf-bfd.h"
#include "elf/amdgpu.h"
#include "event-top.h"
diff --git a/gdb/split-name.c b/gdb/split-name.c
index dc09dec..236caa3 100644
--- a/gdb/split-name.c
+++ b/gdb/split-name.c
@@ -64,4 +64,3 @@ split_name (const char *name, split_style style)
result.emplace_back (&name[previous_len]);
return result;
}
-
diff --git a/gdb/std-operator.def b/gdb/std-operator.def
index d12421e..817d8a1 100644
--- a/gdb/std-operator.def
+++ b/gdb/std-operator.def
@@ -334,8 +334,8 @@ OP (OP_RUST_ARRAY)
/* ================ Ada operators ================ */
-/* X IN A'RANGE(N). N is an immediate operand, surrounded by
- BINOP_IN_BOUNDS before and after. A is an array, X an index
+/* X IN A'RANGE(N). N is an immediate operand, surrounded by
+ BINOP_IN_BOUNDS before and after. A is an array, X an index
value. Evaluates to true iff X is within range of the Nth
dimension (1-based) of A. (A multi-dimensional array
type is represented as array of array of ...) */
@@ -353,18 +353,18 @@ OP (OP_ATR_SIZE)
OP (OP_ATR_TAG)
OP (OP_ATR_VAL)
-/* Ada type qualification. It is encoded as for UNOP_CAST, above,
+/* Ada type qualification. It is encoded as for UNOP_CAST, above,
and denotes the TYPE'(EXPR) construct. */
OP (UNOP_QUAL)
-/* X IN TYPE. The `TYPE' argument is immediate, with
- UNOP_IN_RANGE before and after it. True iff X is a member of
+/* X IN TYPE. The `TYPE' argument is immediate, with
+ UNOP_IN_RANGE before and after it. True iff X is a member of
type TYPE (typically a subrange). */
OP (UNOP_IN_RANGE)
/* An aggregate. A single immediate operand, N>0, gives
the number of component specifications that follow. The
- immediate operand is followed by a second OP_AGGREGATE.
+ immediate operand is followed by a second OP_AGGREGATE.
Next come N component specifications. A component
specification is either an OP_OTHERS (others=>...), an
OP_CHOICES (for named associations), or other expression (for
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 45aca07..9336f5d 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1908,7 +1908,7 @@ struct compunit_symtab : intrusive_list_node<compunit_symtab>
/* Set m_blockvector. */
void set_blockvector (std::unique_ptr<struct blockvector> blockvector);
-
+
bool locations_valid () const
{
return m_locations_valid;
diff --git a/gdb/target-float.c b/gdb/target-float.c
index 9b0376f..dddf5d1 100644
--- a/gdb/target-float.c
+++ b/gdb/target-float.c
@@ -2491,4 +2491,3 @@ target_float_compare (const gdb_byte *x, const struct type *type_x,
const target_float_ops *ops = get_target_float_ops (type_x, type_y);
return ops->compare (x, type_x, y, type_y);
}
-
diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
index 36cc5f4..091010a 100644
--- a/gdb/testsuite/gdb.base/environ.exp
+++ b/gdb/testsuite/gdb.base/environ.exp
@@ -13,7 +13,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
-gdb_start
+# Make sure there is at least one environment variable.
+save_vars { env(GDB_TEST_ENV_VAR) } {
+ setenv GDB_TEST_ENV_VAR abc
+ gdb_start
+}
proc test_set_show_env_var { name value test_name } {
gdb_test_no_output "set environment $name $value" "$test_name"
@@ -29,11 +33,20 @@ proc test_set_show_env_var_equal { name value test_name } {
# Verify that we can show all currently-set environment variables.
# It's hard to do this verification since we can't really compare each
-# entry with the current environment. So we just check to see if
-# there is anything that looks like an environment variable being
-# printed.
-gdb_test "show environment" "(\[A-Za-z_\]+=.*)+" \
- "show environment works"
+# entry with the current environment. So we just check to see if the
+# environment variable we set at startup is printed.
+set saw_env 0
+gdb_test_multiple "show environment" "show environment works" -lbl {
+ -re "\r\nGDB_TEST_ENV_VAR=abc" {
+ incr saw_env 1
+ exp_continue
+ }
+
+ -re "\r\n$gdb_prompt $" {
+ }
+}
+
+gdb_assert {$saw_env == 1} "show environment displayed variable"
# Verify that we can unset a specific environment variable.
gdb_test_no_output "unset environment EDITOR" "unset environment variable"
diff --git a/gdb/testsuite/gdb.base/list-multi-source.c b/gdb/testsuite/gdb.base/list-multi-source.c
new file mode 100644
index 0000000..ab2b6a0
--- /dev/null
+++ b/gdb/testsuite/gdb.base/list-multi-source.c
@@ -0,0 +1,60 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+extern int function_a (void);
+extern int function_b (void);
+
+#ifdef MAIN
+int
+main (void)
+{
+ int res;
+
+ res = function_a ();
+
+ res += function_b ();
+
+ return res;
+}
+#endif
+
+#if defined FILE_A || defined FILE_B
+static int
+get_value_common (void)
+{
+ /* NOTE: When reading this file in the source tree, the variable used in
+ the return statement below will be replaced by a constant value when
+ the file is copied into the source tree. */
+ return value_to_return; /* List this line. */
+}
+#endif
+
+#ifdef FILE_A
+int
+function_a (void)
+{
+ return get_value_common ();
+}
+#endif
+
+#ifdef FILE_B
+int
+function_b (void)
+{
+ return get_value_common ();
+}
+#endif
diff --git a/gdb/testsuite/gdb.base/list-multi-source.exp b/gdb/testsuite/gdb.base/list-multi-source.exp
new file mode 100644
index 0000000..887ff96
--- /dev/null
+++ b/gdb/testsuite/gdb.base/list-multi-source.exp
@@ -0,0 +1,129 @@
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test that 'list FILE:LINE' can print multiple results if FILE
+# matches multiple files from the source tree.
+#
+# Then test that we can use 'list DIR/FILE:LINE' to restrict the
+# results to a single source file.
+
+# With a remote host, source files are automatically copied to the
+# host by dejagnu, and this drops the directory structure that is
+# needed for this test to work, i.e. we need a/foo.c and b/foo.c, but
+# dejagnu's automatic copying just gives us a single foo.c. Instead
+# of trying to fix this, for now at least, just skip remote host
+# testing.
+require {!is_remote host}
+
+# This test uses a single source file that is copied into the build
+# tree 3 times. The three copies are then copied with different
+# defines set so that we see different functions in each copy.
+standard_testfile .c
+
+# Create the source tree within the build directory.
+set src_root [standard_output_file "src"]
+set src_a "$src_root/a"
+set src_b "$src_root/b"
+set file_a "$src_a/foo.c"
+set file_b "$src_b/foo.c"
+set file_main "$src_root/main.c"
+file mkdir "$src_root"
+file mkdir "$src_a"
+file mkdir "$src_b"
+
+# Helper proc. Copy global SRCFILE to DEST, replacing
+# 'value_to_return' with VALUE during the copy.
+proc copy_and_update_source_file { dest value } {
+ # Open the source file for reading.
+ set in [open "$::srcdir/$::subdir/$::srcfile" r]
+
+ # Read in the entire contents of the file. This should be fine as
+ # the input file is not large.
+ set file_content [read $in]
+
+ # Close the input file.
+ close $in
+
+ # Perform the replacement over the entire file contents.
+ set updated_content [string map \
+ [list "value_to_return" $value] \
+ $file_content]
+
+ # Open the destination file for writing.
+ set out [open $dest w]
+
+ # Write the modified content to the destination file.
+ puts -nonewline $out $updated_content
+
+ # Close the output file.
+ close $out
+}
+
+# Make three copies of the single source file in the build directory
+# based source tree. Two of the source files are modified slighly to
+# make the output of 'list' unique for each copy.
+file copy "$srcdir/$subdir/$srcfile" "$file_main"
+copy_and_update_source_file $file_a "3"
+copy_and_update_source_file $file_b "-3"
+
+# Build the executable. Use defines to make the source files
+# different.
+if { [prepare_for_testing_full "failed to prepare" \
+ [list $testfile debug \
+ $file_main [list debug additional_flags=-DMAIN] \
+ $file_a [list debug additional_flags=-DFILE_A] \
+ $file_b [list debug additional_flags=-DFILE_B]]]} {
+ return
+}
+
+# The LINENUM we should list, and the first and last lines that should
+# appear in the list output.
+set linenum [gdb_get_line_number "List this line"]
+set first_linenum [expr {$linenum - 5}]
+set last_linenum [expr {$linenum + 4}]
+
+# List using FILE:LINE for a filename that is ambiguous.
+gdb_test "list foo.c:$linenum" \
+ [multi_line \
+ "file: \"\[^\r\n\]+/a/foo.c\", line number: $linenum, symbol: \"get_value_common\"" \
+ "$first_linenum\\s+\[^\r\n\]+" \
+ ".*" \
+ "$linenum\\s+[string_to_regexp {return 3; /* List this line. */}]" \
+ ".*" \
+ "$last_linenum\\s+\[^\r\n\]+" \
+ "file: \"\[^\r\n\]+/b/foo.c\", line number: $linenum, symbol: \"get_value_common\"" \
+ "$first_linenum\\s+\[^\r\n\]+" \
+ ".*" \
+ "$linenum\\s+[string_to_regexp {return -3; /* List this line. */}]" \
+ ".*" \
+ "$last_linenum\\s+\[^\r\n\]+"]
+
+# Now list using a more acurate filename, we should only get a single
+# result.
+gdb_test "list a/foo.c:$linenum" \
+ [multi_line \
+ "^$first_linenum\\s+\[^\r\n\]+" \
+ ".*" \
+ "$linenum\\s+[string_to_regexp {return 3; /* List this line. */}]" \
+ ".*" \
+ "$last_linenum\\s+\[^\r\n\]+"]
+
+gdb_test "list b/foo.c:$linenum" \
+ [multi_line \
+ "^$first_linenum\\s+\[^\r\n\]+" \
+ ".*" \
+ "$linenum\\s+[string_to_regexp {return -3; /* List this line. */}]" \
+ ".*" \
+ "$last_linenum\\s+\[^\r\n\]+"]
diff --git a/gdb/testsuite/gdb.base/local-env.exp b/gdb/testsuite/gdb.base/local-env.exp
new file mode 100644
index 0000000..fedcf9b
--- /dev/null
+++ b/gdb/testsuite/gdb.base/local-env.exp
@@ -0,0 +1,133 @@
+# Copyright 1997-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+# Test the "local-environment" commands.
+
+save_vars { env(GDB_TEST_ENV_VAR) } {
+ setenv GDB_TEST_ENV_VAR abc
+ gdb_start
+}
+
+proc test_set_show_env_var { name value test_name } {
+ gdb_test_no_output "set local-environment $name $value" "$test_name"
+ gdb_test "show local-environment $name" "$name = $value" \
+ "confirm $test_name"
+}
+
+proc test_set_show_env_var_equal { name value test_name } {
+ gdb_test_no_output "set local-environment $name = $value" "$test_name"
+ gdb_test "show local-environment $name" "$name = $value" \
+ "confirm $test_name"
+}
+
+# Verify that we can show all currently-set environment variables.
+# It's hard to do this verification since we can't really compare each
+# entry with the current environment. So we just check to see if
+# there is anything that looks like an environment variable being
+# printed.
+set saw_env 0
+gdb_test_multiple "show environment" "show environment works" -lbl {
+ -re "\r\nGDB_TEST_ENV_VAR=abc" {
+ incr saw_env 1
+ exp_continue
+ }
+
+ -re "\r\n$gdb_prompt $" {
+ }
+}
+
+gdb_assert {$saw_env == 1} "show environment displayed variable"
+
+# Verify that we can unset a specific environment variable.
+gdb_test_no_output "unset local-environment EDITOR" \
+ "unset environment variable"
+
+gdb_test "show local-environment EDITOR" \
+ "Environment variable \"EDITOR\" not defined\." \
+ "confirm unset environment variable worked"
+
+# Verify that we can unset all environment variables.
+gdb_test "unset local-environment" "" "unset all environment variables" \
+ "Delete all environment variables. .y or n. $" \
+ "y"
+
+gdb_test_no_output "show local-environment" \
+ "all environment variables have been unset"
+
+# Verify that we can set a specific environment variable.
+test_set_show_env_var "EDITOR" "emacs" "set environment variable"
+
+# Verify that GDB responds gracefully to a request to set environment,
+# with no variable name.
+gdb_test "set local-environment" \
+ "Argument required \\\(environment variable and value\\\)\." \
+ "set environment without arguments"
+
+# I'm not sure just what GDB has in mind in explicitly checking
+# for this variant, but since GDB handles it, test it.
+gdb_test "set local-environment =" \
+ "Argument required \\\(environment variable to set\\\)\." \
+ "set environment without variable name"
+
+# Setting an environment variable without a value sets it to a NULL
+# value.
+gdb_test "set local-environment EDITOR" \
+ "Setting environment variable \"EDITOR\" to null value\." \
+ "set environment variable to null value"
+gdb_test "show local-environment EDITOR" "EDITOR = " \
+ "show null environment variable"
+
+# Verify that GDB responds gracefully to an attempt to show a
+# non-existent environment variable. (We hope this variable is
+# undefined!)
+gdb_test "show local-environment FOOBARBAZGRUNGESPAZBALL" \
+ "Environment variable \"FOOBARBAZGRUNGESPAZBALL\" not defined\." \
+ "show non-existent environment variable"
+
+# Verify that GDB can set an environment variable hitherto undefined.
+test_set_show_env_var "FOOBARBAZGRUNGESPAZBALL" "t" \
+ "set environment variable previously undefined"
+
+# Verify that GDB can also set an environment variable using the "="
+# syntax.
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "y" \
+ "set environment variable using = syntax"
+
+# Verify that GDB can set an environment variable to a value that has
+# an embedded (trailing, in this case) equals.
+test_set_show_env_var_equal "FOOBARBAZGRUNGESPAZBALL" "t=" \
+ "set environment variable with trailing equals"
+
+# Verify that GDB can set an environment variable to a value preceded
+# by whitespace, and that such whitespace is ignored (not included
+# in the set value).
+gdb_test_no_output \
+ "set local-environment FOOBARBAZGRUNGESPAZBALL = foo" \
+ "set environment variable with trailing whitespace"
+gdb_test "show local-environment FOOBARBAZGRUNGESPAZBALL" \
+ "FOOBARBAZGRUNGESPAZBALL = foo" \
+ "confirm set environment variable with trailing whitespace"
+
+# Verify that the setting affects the "pipe" command.
+gdb_test "pipe print 23 | printenv | grep FOOBARBAZGRUNGESPAZBALL" \
+ "FOOBARBAZGRUNGESPAZBALL=foo" \
+ "set local-environment affects pipe"
+
+# Verify that the setting affects "shell".
+gdb_test "shell printenv | grep FOOBARBAZGRUNGESPAZBALL" \
+ "FOOBARBAZGRUNGESPAZBALL=foo" \
+ "set local-environment affects shell"
+
+gdb_exit
diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp
index a28e07a..38d1934 100644
--- a/gdb/testsuite/gdb.base/long_long.exp
+++ b/gdb/testsuite/gdb.base/long_long.exp
@@ -133,25 +133,11 @@ gdb_test_ptr "p/a val.oct" "" "" "0x77053977" "0xa72ee53977053977"
gdb_test "p/c val.oct" "'w'"
if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
- # ARM FPA floating point numbers are not strictly little endian or big
- # endian, but a hybrid. They are in little endian format with the two
- # words swapped in big endian format.
- # EABI targets default to natural-endian VFP format.
-
- if { ([istarget "arm*-*-*"]) \
- && !([istarget "*-*-*eabi*"] || \
- [istarget "*-*-mingw32ce*"] || \
- [istarget "*-*-openbsd*"]) } then {
- # assume the long long represents a floating point double in ARM format
- gdb_test "p/f val.oct" "2.1386676354387559e\\+265"
- } else {
- # assume the long long represents a floating point double in little
- # endian format
- gdb_test "p/f val.oct" "-5.9822653797615723e-120"
- }
+ set re_val_oct_f [string_to_regexp "-5.9822653797615723e-120"]
} else {
- gdb_test "p/f val.oct" "-2.42716126e-15"
+ set re_val_oct_f [string_to_regexp "-2.42716126e-15"]
}
+gdb_test "p/f val.oct" $re_val_oct_f
gdb_test_char "p/x *(char *)c" "0x1"
gdb_test_char "p/d *(char *)c" "1"
@@ -208,11 +194,7 @@ gdb_test "x/o w" "0110642547"
gdb_test "x/t w" "00000001001000110100010101100111"
gdb_test_xptr "x/a" { b "" } { h "" } { w "0x1234567" } { g "0x123456789abcdef" }
gdb_test "x/c b" "1 '.001'"
-if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
- gdb_test "x/f &val.oct" "-5.9822653797615723e-120"
-} else {
- gdb_test "x/f &val.oct" "-2.42716126e-15"
-}
+gdb_test "x/f &val.oct" $re_val_oct_f
# Implicit Giant size (except for a, c, and f)
@@ -225,9 +207,9 @@ gdb_test "x/2t g" "0000000100100011010001010110011110001001101010111100110111101
gdb_test_xptr "x/2a" { b "" } { h "" } { w "0x1234567.*0xa72ee539" } { g "0x123456789abcdef.*0xa72ee53977053977" }
gdb_test "x/2c b" "1 '.001'.*-89 '.\[0-9\]*'"
if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
- gdb_test "x/2f &val.oct" "-5.9822653797615723e-120.*-5.9041889495880968e-100"
+ gdb_test "x/2f &val.oct" "$re_val_oct_f.*-5.9041889495880968e-100"
} else {
- gdb_test "x/2f &val.oct" "-2.42716126e-15"
+ gdb_test "x/2f &val.oct" "$re_val_oct_f"
}
# Explicit sizes, and two memory locations ...
@@ -266,7 +248,7 @@ gdb_test "x/2go g" "04432126361152746757.*01234567123456701234567"
gdb_test "x/2gt g" "0000000100100011010001010110011110001001101010111100110111101111.*1010011100101110111001010011100101110111000001010011100101110111"
gdb_test_ptr "x/2ga g" "" "" "0x89abcdef.*0x77053977" "0x123456789abcdef.*0xa72ee53977053977"
gdb_test "x/2gc g" "-17 '.\[0-9\]*'.*119 'w'"
-gdb_test "x/2gf g" "3.5127005640885037e-303.*-5.9822653797615723e-120"
+gdb_test "x/2gf g" "3.5127005640885037e-303.*$re_val_oct_f"
# Repeat behavior.
gdb_test "x/2bx b" "0x01.*0xa7" "set up for repeat"
diff --git a/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp b/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp
index 43842ba..6f8a77c 100644
--- a/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp
+++ b/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp
@@ -57,7 +57,8 @@ proc run_test { target_non_stop non_stop } {
gdb_test_no_output "set non-stop $non_stop"
# Start the first inferior running in the background.
- gdb_test -no-prompt-anchor "run&" "Starting program: .*" "start background inferior"
+ gdb_test -no-prompt-anchor "run&" "Starting program: .*" \
+ "start background inferior"
# Add a second inferior.
gdb_test "add-inferior" "Added inferior 2.*"
@@ -87,26 +88,26 @@ proc run_test { target_non_stop non_stop } {
exp_continue
}
- -re "^\\s+Id\\s+Target Id\\s+Frame\\s*\r\n" {
+ -re {^\s+Id\s+Target Id\s+Frame\s*\r\n} {
exp_continue
}
- -re "^\\s+1\\.1\\s+\[^\r\n\]+\\(running\\)\r\n" {
+ -re {^\s+1\.1\s+[^\r\n]+\(running\)\r\n} {
set state_inferior_1 "running"
exp_continue
}
- -re "^\\*\\s+2\\.1\\s+\[^\r\n\]+\\(running\\)\r\n" {
+ -re {^\*\s+2\.1\s+[^\r\n]+\(running\)\r\n} {
set state_inferior_2 "running"
exp_continue
}
- -re "^\\s+1\\.1\\s+\[^\r\n\]+\r\n" {
+ -re {^\s+1\.1\s+[^\r\n]+\r\n} {
set state_inferior_1 "stopped"
exp_continue
}
- -re "^\\*\\s+2\\.1\\s+\[^\r\n\]+\r\n" {
+ -re {^\*\s+2\.1\s+[^\r\n]+\r\n} {
set state_inferior_2 "stopped"
exp_continue
}
@@ -124,18 +125,19 @@ proc run_test { target_non_stop non_stop } {
}
}
- # Allow inferior 2 to reach main. The confirms that inferior 2 can be
+ # Allow inferior 2 to reach main. This confirms that inferior 2 can be
# set running again.
- gdb_breakpoint main
+ gdb_test "break main inferior 2" \
+ "Breakpoint $::decimal at .*"
gdb_continue_to_breakpoint "breakpoint in main"
gdb_test "bt 1" \
- "#0\\s+main \\(\\) at\[^\r\n\]+" \
+ {#0\s+main \(\) at [^\r\n]+} \
"check inferior 2 is in main"
# Switch to inferior 1 and allow it to continue. This is a
# critical part of the test. When the test was added a bug (in
# all-stop mode) would leave inferior 1 stopped, but GDB code
- # would think the thread was running. As such. the thread
+ # would think the thread was running. As such, the thread
# couldn't be resumed again.
gdb_test "inferior 1" "Switching to inferior 1.*"
@@ -151,8 +153,8 @@ proc run_test { target_non_stop non_stop } {
gdb_continue_to_breakpoint "continue to breakpoint in breakpt"
gdb_test "bt 1" \
[multi_line \
- "#0\\s+breakpt \\(\\) at\[^\r\n\]+" \
- "\\(More stack frames follow\\.\\.\\.\\)"] \
+ {#0\s+breakpt \(\) at [^\r\n]+} \
+ [string_to_regexp "(More stack frames follow...)"]] \
"check inferior 1 is in breakpt"
# Switch back to inferior 2. The testing infrastructure will try to
diff --git a/gdb/testsuite/gdb.rocm/break-kernel-no-debug-info.exp b/gdb/testsuite/gdb.rocm/break-kernel-no-debug-info.exp
index 7773ff3..71c67ad 100644
--- a/gdb/testsuite/gdb.rocm/break-kernel-no-debug-info.exp
+++ b/gdb/testsuite/gdb.rocm/break-kernel-no-debug-info.exp
@@ -35,7 +35,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile {hip nodebug}]} {
clean_restart
with_rocm_gpu_lock {
- gdb_test "file $::binfile" ".*No debugging symbols.*" "load file"
+ gdb_load $::binfile
if {![runto_main]} {
return
diff --git a/gdb/unittests/child-path-selftests.c b/gdb/unittests/child-path-selftests.c
index 95b2c34..5c435f1 100644
--- a/gdb/unittests/child-path-selftests.c
+++ b/gdb/unittests/child-path-selftests.c
@@ -63,4 +63,3 @@ INIT_GDB_FILE (child_path_selftests)
selftests::register_test ("child_path",
selftests::child_path::test);
}
-
diff --git a/gdb/unittests/mkdir-recursive-selftests.c b/gdb/unittests/mkdir-recursive-selftests.c
index b2ae383..e2f577a 100644
--- a/gdb/unittests/mkdir-recursive-selftests.c
+++ b/gdb/unittests/mkdir-recursive-selftests.c
@@ -85,4 +85,3 @@ INIT_GDB_FILE (mkdir_recursive_selftests)
selftests::register_test ("mkdir_recursive",
selftests::mkdir_recursive::test);
}
-
diff --git a/gdb/unwind_stop_reasons.def b/gdb/unwind_stop_reasons.def
index 432064f..cb45768 100644
--- a/gdb/unwind_stop_reasons.def
+++ b/gdb/unwind_stop_reasons.def
@@ -17,17 +17,17 @@
/* Reasons why frames could not be further unwound
SET (name, description)
-
+
After this reason name, all reasons should be considered errors;
i.e.: abnormal stack termination.
- FIRST_ERROR (name)
-
+ FIRST_ERROR (name)
+
First and Last reason defined
FIRST_ENTRY (name)
LAST_ENTRY (name) */
#ifdef SET
-/* No particular reason; either we haven't tried unwinding yet,
+/* No particular reason; either we haven't tried unwinding yet,
or we didn't fail. */
SET (UNWIND_NO_REASON, "no reason")