aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/cli/cli-cmds.c5
-rw-r--r--gdb/dwarf2/read.c63
-rw-r--r--gdb/inflow.c23
-rw-r--r--gdb/mingw-hdep.c5
-rw-r--r--gdb/solib-frv.h2
-rw-r--r--gdb/svr4-tls-tdep.c2
-rw-r--r--gdb/terminal.h15
-rw-r--r--gdb/testsuite/gdb.ada/operator_call.exp6
8 files changed, 90 insertions, 31 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 5e887f5..a15a04a 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -51,6 +51,7 @@
#include "cli/cli-cmds.h"
#include "cli/cli-style.h"
#include "cli/cli-utils.h"
+#include "terminal.h"
#include "extension.h"
#include "gdbsupport/pathstuff.h"
@@ -949,6 +950,9 @@ shell_escape (const char *arg, int from_tty)
static void
shell_command (const char *arg, int from_tty)
{
+ scoped_gdb_ttystate save_restore_gdb_ttystate;
+ restore_initial_gdb_ttystate ();
+
shell_escape (arg, from_tty);
}
@@ -2898,6 +2902,7 @@ This can be changed using \"set listsize\", and the current value\n\
can be shown using \"show listsize\"."));
add_com_alias ("l", list_cmd, class_files, 1);
+ set_cmd_completer(list_cmd, location_completer);
c = add_com ("disassemble", class_vars, disassemble_command, _("\
Disassemble a specified section of memory.\n\
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 5e18e45..634d67a 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9918,33 +9918,37 @@ static void
handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
struct field *field)
{
- struct attribute *attr;
+ const auto data_member_location_attr
+ = dwarf2_attr (die, DW_AT_data_member_location, cu);
- attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
- if (attr != NULL)
+ if (data_member_location_attr != nullptr)
{
bool has_bit_offset = false;
LONGEST bit_offset = 0;
LONGEST anonymous_size = 0;
+ const auto bit_offset_attr = dwarf2_attr (die, DW_AT_bit_offset, cu);
- attribute *attr2 = dwarf2_attr (die, DW_AT_bit_offset, cu);
- if (attr2 != nullptr && attr2->form_is_constant ())
+ if (bit_offset_attr != nullptr && bit_offset_attr->form_is_constant ())
{
has_bit_offset = true;
- bit_offset = attr2->confused_constant ().value_or (0);
- attr2 = dwarf2_attr (die, DW_AT_byte_size, cu);
- if (attr2 != nullptr && attr2->form_is_constant ())
+ bit_offset = bit_offset_attr->confused_constant ().value_or (0);
+
+ const auto byte_size_attr = dwarf2_attr (die, DW_AT_byte_size, cu);
+
+ if (byte_size_attr != nullptr && byte_size_attr->form_is_constant ())
{
/* The size of the anonymous object containing
the bit field is explicit, so use the
indicated size (in bytes). */
- anonymous_size = attr2->unsigned_constant ().value_or (0);
+ anonymous_size
+ = byte_size_attr->unsigned_constant ().value_or (0);
}
}
- if (attr->form_is_constant ())
+ if (data_member_location_attr->form_is_constant ())
{
- LONGEST offset = attr->confused_constant ().value_or (0);
+ LONGEST offset
+ = data_member_location_attr->confused_constant ().value_or (0);
/* Work around this GCC 11 bug, where it would erroneously use -1
data member locations, instead of 0:
@@ -9962,11 +9966,17 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
if (has_bit_offset)
apply_bit_offset_to_field (*field, bit_offset, anonymous_size);
}
- else if (attr->form_is_block ())
+ else if (data_member_location_attr->form_is_block ())
{
CORE_ADDR offset;
- if (decode_locdesc (attr->as_block (), cu, &offset))
- field->set_loc_bitpos (offset * bits_per_byte);
+ if (decode_locdesc (data_member_location_attr->as_block (), cu,
+ &offset))
+ {
+ field->set_loc_bitpos (offset * bits_per_byte);
+
+ if (has_bit_offset)
+ apply_bit_offset_to_field (*field, bit_offset, anonymous_size);
+ }
else
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
@@ -9985,8 +9995,8 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
else
dlbaton = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct dwarf2_locexpr_baton);
- dlbaton->data = attr->as_block ()->data;
- dlbaton->size = attr->as_block ()->size;
+ dlbaton->data = data_member_location_attr->as_block ()->data;
+ dlbaton->size = data_member_location_attr->as_block ()->size;
/* When using this baton, we want to compute the address
of the field, not the value. This is why
is_reference is set to false here. */
@@ -9999,16 +10009,19 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
}
else
complaint (_("Unsupported form %s for DW_AT_data_member_location"),
- dwarf_form_name (attr->form));
+ dwarf_form_name (data_member_location_attr->form));
}
else
{
- attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
- if (attr != nullptr)
+ const auto data_bit_offset_attr
+ = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
+
+ if (data_bit_offset_attr != nullptr)
{
- if (attr->form_is_constant ())
- field->set_loc_bitpos (attr->unsigned_constant ().value_or (0));
- else if (attr->form_is_block ())
+ if (data_bit_offset_attr->form_is_constant ())
+ field->set_loc_bitpos (data_bit_offset_attr->unsigned_constant ()
+ .value_or (0));
+ else if (data_bit_offset_attr->form_is_block ())
{
/* This is a DWARF extension. See
https://dwarfstd.org/issues/250501.1.html. */
@@ -10016,8 +10029,8 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
dwarf2_locexpr_baton *dlbaton
= OBSTACK_ZALLOC (&per_objfile->objfile->objfile_obstack,
dwarf2_locexpr_baton);
- dlbaton->data = attr->as_block ()->data;
- dlbaton->size = attr->as_block ()->size;
+ dlbaton->data = data_bit_offset_attr->as_block ()->data;
+ dlbaton->size = data_bit_offset_attr->as_block ()->size;
dlbaton->per_objfile = per_objfile;
dlbaton->per_cu = cu->per_cu;
@@ -10025,7 +10038,7 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
}
else
complaint (_("Unsupported form %s for DW_AT_data_bit_offset"),
- dwarf_form_name (attr->form));
+ dwarf_form_name (data_bit_offset_attr->form));
}
}
}
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 31e1565..4f1c8ef 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -55,6 +55,20 @@ static void child_terminal_ours_1 (target_terminal_state);
static struct serial *stdin_serial;
+/* See terminal.h. */
+
+scoped_gdb_ttystate::scoped_gdb_ttystate ()
+{
+ m_ttystate = serial_get_tty_state (stdin_serial);
+}
+
+/* See terminal.h. */
+
+scoped_gdb_ttystate::~scoped_gdb_ttystate ()
+{
+ serial_set_tty_state (stdin_serial, m_ttystate);
+}
+
/* Terminal related info we need to keep track of. Each inferior
holds an instance of this structure --- we save it whenever the
corresponding inferior stops, and restore it to the terminal when
@@ -163,6 +177,15 @@ set_initial_gdb_ttystate (void)
}
}
+/* See terminal.h. */
+
+void
+restore_initial_gdb_ttystate ()
+{
+ if (initial_gdb_ttystate != nullptr)
+ serial_set_tty_state (stdin_serial, initial_gdb_ttystate);
+}
+
/* Does GDB have a terminal (on stdin)? */
static int
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index 481bd41..a4e9cf5 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -493,10 +493,7 @@ show_maint_console_translation_mode (struct ui_file *file, int from_tty,
console_translation_mode.c_str ());
}
-extern void _initialize_mingw_hdep ();
-
-void
-_initialize_mingw_hdep ()
+INIT_GDB_FILE (mingw_hdep)
{
add_setshow_string_cmd ("console-translation-mode",
class_maintenance,
diff --git a/gdb/solib-frv.h b/gdb/solib-frv.h
index 710a424..a2f3558 100644
--- a/gdb/solib-frv.h
+++ b/gdb/solib-frv.h
@@ -1,5 +1,5 @@
/* Handle FR-V (FDPIC) shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/svr4-tls-tdep.c b/gdb/svr4-tls-tdep.c
index 75d06a4..1f36d57 100644
--- a/gdb/svr4-tls-tdep.c
+++ b/gdb/svr4-tls-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux, architecture independent.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/terminal.h b/gdb/terminal.h
index 54e5e98..720fd4a 100644
--- a/gdb/terminal.h
+++ b/gdb/terminal.h
@@ -19,6 +19,8 @@
#ifndef GDB_TERMINAL_H
#define GDB_TERMINAL_H
+#include "serial.h"
+
struct inferior;
extern void new_tty_prefork (std::string ttyname);
@@ -43,4 +45,17 @@ extern void gdb_save_tty_state (void);
have had a chance to alter it. */
extern void set_initial_gdb_ttystate (void);
+/* Restore initial tty state. */
+extern void restore_initial_gdb_ttystate (void);
+
+/* An RAII-based object that saves the tty state, and then restores it again
+ when this object is destroyed. */
+class scoped_gdb_ttystate
+{
+public:
+ scoped_gdb_ttystate ();
+ ~scoped_gdb_ttystate ();
+private:
+ serial_ttystate m_ttystate;
+};
#endif /* GDB_TERMINAL_H */
diff --git a/gdb/testsuite/gdb.ada/operator_call.exp b/gdb/testsuite/gdb.ada/operator_call.exp
index e96107b..dc7f679 100644
--- a/gdb/testsuite/gdb.ada/operator_call.exp
+++ b/gdb/testsuite/gdb.ada/operator_call.exp
@@ -71,6 +71,12 @@ proc test_with_menu {command result} {
fail $command
}
}
+ "Argument to arithmetic operation not a number or boolean." {
+ fail $command
+ }
+ -re "No definition of \".*\" in current context." {
+ fail $command
+ }
timeout {
fail "$command (timeout)"
}