diff options
author | Tom Tromey <tromey@adacore.com> | 2023-07-11 09:54:01 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-07-14 10:52:56 -0600 |
commit | cb26e4bbedbc9149507b0f59c2f137d9e213e8c9 (patch) | |
tree | f923428a64e74c4096073a97976642c5dbeb8ae4 /gdb/aix-thread.c | |
parent | eeaffa60ebbfdbcdca3aa2deb1ac97c57460225d (diff) | |
download | gdb-cb26e4bbedbc9149507b0f59c2f137d9e213e8c9.zip gdb-cb26e4bbedbc9149507b0f59c2f137d9e213e8c9.tar.gz gdb-cb26e4bbedbc9149507b0f59c2f137d9e213e8c9.tar.bz2 |
Introduce scoped_restore_current_inferior_for_memory
This introduces a new class,
scoped_restore_current_inferior_for_memory, and arranges to use it in
a few places. This class is intended to handle setting up and
restoring the various globals that are needed to read or write memory
-- but without invalidating the frame cache.
I wasn't able to test the change to aix-thread.c.
Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/aix-thread.c')
-rw-r--r-- | gdb/aix-thread.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index fbe80d6..74cc67c 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -615,13 +615,8 @@ pdc_read_data (pthdb_user_t user_current_pid, void *buf, /* This is needed to eliminate the dependency of current thread which is null so that thread reads the correct target memory. */ { - scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid); - inferior_ptid = ptid_t (user_current_pid); - scoped_restore_current_inferior restore_inferior; - set_current_inferior (inf); - - scoped_restore_current_program_space restore_current_progspace; - set_current_program_space (inf->pspace); + scoped_restore_current_inferior_for_memory save_inferior + (inf, ptid_t (user_current_pid)); status = target_read_memory (addr, (gdb_byte *) buf, len); } ret = status == 0 ? PDC_SUCCESS : PDC_FAILURE; @@ -648,13 +643,8 @@ pdc_write_data (pthdb_user_t user_current_pid, void *buf, user_current_pid, (long) buf, hex_string (addr), len); { - scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid); - inferior_ptid = ptid_t (user_current_pid); - scoped_restore_current_inferior restore_inferior; - set_current_inferior (inf); - - scoped_restore_current_program_space restore_current_progspace; - set_current_program_space (inf->pspace); + scoped_restore_current_inferior_for_memory save_inferior + (inf, ptid_t (user_current_pid)); status = target_write_memory (addr, (gdb_byte *) buf, len); } |