aboutsummaryrefslogtreecommitdiff
path: root/gdb/displaced-stepping.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/displaced-stepping.c')
-rw-r--r--gdb/displaced-stepping.c67
1 files changed, 32 insertions, 35 deletions
diff --git a/gdb/displaced-stepping.c b/gdb/displaced-stepping.c
index 06b32a8..dce9726 100644
--- a/gdb/displaced-stepping.c
+++ b/gdb/displaced-stepping.c
@@ -40,7 +40,7 @@ static void
show_debug_displaced (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Displace stepping debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Displace stepping debugging is %s.\n"), value);
}
displaced_step_prepare_status
@@ -112,18 +112,17 @@ displaced_step_buffers::prepare (thread_info *thread, CORE_ADDR &displaced_pc)
/* Save the original contents of the displaced stepping buffer. */
buffer->saved_copy.resize (len);
- int status = target_read_memory (buffer->addr,
- buffer->saved_copy.data (), len);
+ int status
+ = target_read_memory (buffer->addr, buffer->saved_copy.data (), len);
if (status != 0)
throw_error (MEMORY_ERROR,
- _("Error accessing memory address %s (%s) for "
- "displaced-stepping scratch space."),
+ _ ("Error accessing memory address %s (%s) for "
+ "displaced-stepping scratch space."),
paddress (arch, buffer->addr), safe_strerror (status));
- displaced_debug_printf ("saved %s: %s",
- paddress (arch, buffer->addr),
- displaced_step_dump_bytes
- (buffer->saved_copy.data (), len).c_str ());
+ displaced_debug_printf (
+ "saved %s: %s", paddress (arch, buffer->addr),
+ displaced_step_dump_bytes (buffer->saved_copy.data (), len).c_str ());
/* Save this in a local variable first, so it's released if code below
throws. */
@@ -148,12 +147,10 @@ displaced_step_buffers::prepare (thread_info *thread, CORE_ADDR &displaced_pc)
/* Reset the displaced step buffer state if we failed to write PC.
Otherwise we will prevent this buffer from being used, as it will
always have a thread in buffer->current_thread. */
- auto reset_buffer = make_scope_exit
- ([buffer] ()
- {
- buffer->current_thread = nullptr;
- buffer->copy_insn_closure.reset ();
- });
+ auto reset_buffer = make_scope_exit ([buffer] () {
+ buffer->current_thread = nullptr;
+ buffer->copy_insn_closure.reset ();
+ });
/* Adjust the PC so it points to the displaced step buffer address that will
be used. This needs to be done after we save the copy_insn_closure, as
@@ -182,8 +179,8 @@ displaced_step_buffers::prepare (thread_info *thread, CORE_ADDR &displaced_pc)
}
static void
-write_memory_ptid (ptid_t ptid, CORE_ADDR memaddr,
- const gdb_byte *myaddr, int len)
+write_memory_ptid (ptid_t ptid, CORE_ADDR memaddr, const gdb_byte *myaddr,
+ int len)
{
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
@@ -246,11 +243,10 @@ displaced_step_buffers::finish (gdbarch *arch, thread_info *thread,
ULONGEST len = gdbarch_max_insn_length (arch);
/* Restore memory of the buffer. */
- write_memory_ptid (thread->ptid, buffer->addr,
- buffer->saved_copy.data (), len);
+ write_memory_ptid (thread->ptid, buffer->addr, buffer->saved_copy.data (),
+ len);
- displaced_debug_printf ("restored %s %s",
- thread->ptid.to_string ().c_str (),
+ displaced_debug_printf ("restored %s %s", thread->ptid.to_string ().c_str (),
paddress (arch, buffer->addr));
regcache *rc = get_thread_regcache (thread);
@@ -261,8 +257,7 @@ displaced_step_buffers::finish (gdbarch *arch, thread_info *thread,
if (instruction_executed_successfully)
{
gdbarch_displaced_step_fixup (arch, copy_insn_closure.get (),
- buffer->original_pc,
- buffer->addr, rc);
+ buffer->original_pc, buffer->addr, rc);
return DISPLACED_STEP_FINISH_STATUS_OK;
}
else
@@ -282,11 +277,11 @@ displaced_step_buffers::copy_insn_closure_by_addr (CORE_ADDR addr)
for (const displaced_step_buffer &buffer : m_buffers)
{
if (addr == buffer.addr)
- {
- /* The closure information should always be available. */
- gdb_assert (buffer.copy_insn_closure.get () != nullptr);
- return buffer.copy_insn_closure.get ();
- }
+ {
+ /* The closure information should always be available. */
+ gdb_assert (buffer.copy_insn_closure.get () != nullptr);
+ return buffer.copy_insn_closure.get ();
+ }
}
return nullptr;
@@ -313,15 +308,17 @@ displaced_step_buffers::restore_in_ptid (ptid_t ptid)
}
void _initialize_displaced_stepping ();
+
void
_initialize_displaced_stepping ()
{
- add_setshow_boolean_cmd ("displaced", class_maintenance,
- &debug_displaced, _("\
-Set displaced stepping debugging."), _("\
-Show displaced stepping debugging."), _("\
+ add_setshow_boolean_cmd ("displaced", class_maintenance, &debug_displaced,
+ _ ("\
+Set displaced stepping debugging."),
+ _ ("\
+Show displaced stepping debugging."),
+ _ ("\
When non-zero, displaced stepping specific debugging is enabled."),
- NULL,
- show_debug_displaced,
- &setdebuglist, &showdebuglist);
+ NULL, show_debug_displaced, &setdebuglist,
+ &showdebuglist);
}