]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: rename scoped_gdb_tty_state, and make it non-copyable
authorAndrew Burgess <aburgess@redhat.com>
Sat, 13 Dec 2025 08:36:01 +0000 (08:36 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 16 Dec 2025 14:01:42 +0000 (14:01 +0000)
The scoped_gdb_tty_state class seems misnamed.  For save/restore type
classes the pattern in GDB is usually scoped_restore_<whatever>, so
lets rename this to scoped_restore_tty_state.  I dropped the 'gdb' part
of the name as the underlying functions being called are
serial_get_tty_state and serial_set_tty_state, so the new name
matches (I think) what's actually being called.

I've also made the class non-copyable like other scoped_restore_
classes.

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/cli/cli-cmds.c
gdb/inflow.c
gdb/terminal.h

index 362f239f896f233d2558cbb2ed18c2280e5aba2f..eda48ae807142d64841bf5f599a5aa78a5d28ca2 100644 (file)
@@ -950,7 +950,7 @@ 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;
+  scoped_restore_tty_state save_restore_gdb_ttystate;
   restore_initial_gdb_ttystate ();
 
   shell_escape (arg, from_tty);
index ccab019158a86e5c878148ae55d8e578c6bb00d7..518b2dcf4e0dd29d0dfd28938d350cd4042e5b11 100644 (file)
@@ -57,14 +57,14 @@ static struct serial *stdin_serial;
 
 /* See terminal.h.  */
 
-scoped_gdb_ttystate::scoped_gdb_ttystate ()
+scoped_restore_tty_state::scoped_restore_tty_state ()
 {
   m_ttystate = serial_get_tty_state (stdin_serial);
 }
 
 /* See terminal.h.  */
 
-scoped_gdb_ttystate::~scoped_gdb_ttystate ()
+scoped_restore_tty_state::~scoped_restore_tty_state ()
 {
   serial_set_tty_state (stdin_serial, m_ttystate);
 }
index 87a1aee37fb90631618d8ca22b8fd4d618f35d86..225554a60c397e30fd2a1fd4b20cbbdabea92514 100644 (file)
@@ -49,12 +49,15 @@ extern void set_initial_gdb_ttystate (void);
 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
+   when this object is destroyed.  */
+class scoped_restore_tty_state
 {
 public:
-  scoped_gdb_ttystate ();
-  ~scoped_gdb_ttystate ();
+  scoped_restore_tty_state ();
+  ~scoped_restore_tty_state ();
+
+  DISABLE_COPY_AND_ASSIGN (scoped_restore_tty_state);
+
 private:
   serial_ttystate m_ttystate;
 };