aboutsummaryrefslogtreecommitdiff
path: root/gdb/record-btrace.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2023-02-08 15:36:23 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2023-02-08 15:46:02 -0500
commitc583a2520616c2736cffc389c89a48b159366e6c (patch)
treeb4925f26506fcee96c16119431c01760f05db95d /gdb/record-btrace.c
parentca7f92c2f15b86b09c4a8ad14806bef666308d31 (diff)
downloadgdb-users/simark/clang-format.zip
gdb-users/simark/clang-format.tar.gz
gdb-users/simark/clang-format.tar.bz2
Run clang-format.shusers/simark/clang-format
Change-Id: Ia948cc26d534b0dd02702244d52434b1a2093968
Diffstat (limited to 'gdb/record-btrace.c')
-rw-r--r--gdb/record-btrace.c408
1 files changed, 190 insertions, 218 deletions
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 0daba89..05104f0 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -45,19 +45,20 @@
#include "async-event.h"
#include <forward_list>
-static const target_info record_btrace_target_info = {
- "record-btrace",
- N_("Branch tracing target"),
- N_("Collect control-flow trace and provide the execution history.")
-};
+static const target_info record_btrace_target_info
+ = { "record-btrace", N_ ("Branch tracing target"),
+ N_ ("Collect control-flow trace and provide the execution history.") };
/* The target_ops of record-btrace. */
class record_btrace_target final : public target_ops
{
public:
+
const target_info &info () const override
- { return record_btrace_target_info; }
+ {
+ return record_btrace_target_info;
+ }
strata stratum () const override { return record_stratum; }
@@ -65,15 +66,15 @@ public:
void async (bool) override;
void detach (inferior *inf, int from_tty) override
- { record_detach (this, inf, from_tty); }
+ {
+ record_detach (this, inf, from_tty);
+ }
void disconnect (const char *, int) override;
- void mourn_inferior () override
- { record_mourn_inferior (this); }
+ void mourn_inferior () override { record_mourn_inferior (this); }
- void kill () override
- { record_kill (this); }
+ void kill () override { record_kill (this); }
enum record_method record_method (ptid_t ptid) override;
@@ -86,24 +87,22 @@ public:
void insn_history_range (ULONGEST begin, ULONGEST end,
gdb_disassembly_flags flags) override;
void call_history (int size, record_print_flags flags) override;
- void call_history_from (ULONGEST begin, int size, record_print_flags flags)
- override;
- void call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flags)
- override;
+ void call_history_from (ULONGEST begin, int size,
+ record_print_flags flags) override;
+ void call_history_range (ULONGEST begin, ULONGEST end,
+ record_print_flags flags) override;
bool record_is_replaying (ptid_t ptid) override;
bool record_will_replay (ptid_t ptid, int dir) override;
void record_stop_replaying () override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- int insert_breakpoint (struct gdbarch *,
- struct bp_target_info *) override;
+ int insert_breakpoint (struct gdbarch *, struct bp_target_info *) override;
int remove_breakpoint (struct gdbarch *, struct bp_target_info *,
enum remove_bp_reason) override;
@@ -150,12 +149,8 @@ static const gdb::observers::token record_btrace_thread_observer_token {};
/* Memory access types used in set/show record btrace replay-memory-access. */
static const char replay_memory_access_read_only[] = "read-only";
static const char replay_memory_access_read_write[] = "read-write";
-static const char *const replay_memory_access_types[] =
-{
- replay_memory_access_read_only,
- replay_memory_access_read_write,
- NULL
-};
+static const char *const replay_memory_access_types[]
+ = { replay_memory_access_read_only, replay_memory_access_read_write, NULL };
/* The currently allowed replay memory access type. */
static const char *replay_memory_access = replay_memory_access_read_only;
@@ -207,16 +202,14 @@ static struct cmd_list_element *set_record_btrace_cpu_cmdlist;
/* Print a record-btrace debug message. Use do ... while (0) to avoid
ambiguities when used in if statements. */
-#define DEBUG(msg, args...) \
- do \
- { \
- if (record_debug != 0) \
- gdb_printf (gdb_stdlog, \
- "[record-btrace] " msg "\n", ##args); \
- } \
+#define DEBUG(msg, args...) \
+ do \
+ { \
+ if (record_debug != 0) \
+ gdb_printf (gdb_stdlog, "[record-btrace] " msg "\n", ##args); \
+ } \
while (0)
-
/* Return the cpu configured by the user. Returns NULL if the cpu was
configured as auto. */
const struct btrace_cpu *
@@ -234,7 +227,7 @@ record_btrace_get_cpu (void)
return &record_btrace_cpu;
}
- error (_("Internal error: bad record btrace cpu state."));
+ error (_ ("Internal error: bad record btrace cpu state."));
}
/* Update the branch trace for the current thread and return a pointer to its
@@ -249,7 +242,7 @@ require_btrace_thread (void)
DEBUG ("require");
if (inferior_ptid == null_ptid)
- error (_("No thread."));
+ error (_ ("No thread."));
thread_info *tp = inferior_thread ();
@@ -258,7 +251,7 @@ require_btrace_thread (void)
btrace_fetch (tp, record_btrace_get_cpu ());
if (btrace_is_empty (tp))
- error (_("No trace."));
+ error (_ ("No trace."));
return tp;
}
@@ -346,7 +339,8 @@ record_btrace_push_target (void)
record_btrace_generating_corefile = 0;
format = btrace_format_short_string (record_btrace_conf.format);
- gdb::observers::record_changed.notify (current_inferior (), 1, "btrace", format);
+ gdb::observers::record_changed.notify (current_inferior (), 1, "btrace",
+ format);
}
/* Disable btrace on a set of threads on scope exit. */
@@ -363,17 +357,12 @@ struct scoped_btrace_disable
btrace_disable (tp);
}
- void add_thread (thread_info *thread)
- {
- m_threads.push_front (thread);
- }
+ void add_thread (thread_info *thread) { m_threads.push_front (thread); }
- void discard ()
- {
- m_threads.clear ();
- }
+ void discard () { m_threads.clear (); }
private:
+
std::forward_list<thread_info *> m_threads;
};
@@ -391,7 +380,7 @@ record_btrace_target_open (const char *args, int from_tty)
record_preopen ();
if (!target_has_execution ())
- error (_("The program is not being run."));
+ error (_ ("The program is not being run."));
for (thread_info *tp : current_inferior ()->non_exited_threads ())
if (args == NULL || *args == 0 || number_is_in_list (args, tp->global_num))
@@ -423,8 +412,7 @@ record_btrace_target::stop_recording ()
/* The disconnect method of target record-btrace. */
void
-record_btrace_target::disconnect (const char *args,
- int from_tty)
+record_btrace_target::disconnect (const char *args, int from_tty)
{
struct target_ops *beneath = this->beneath ();
@@ -506,7 +494,7 @@ record_btrace_print_bts_conf (const struct btrace_config_bts *conf)
if (size > 0)
{
suffix = record_btrace_adjust_size (&size);
- gdb_printf (_("Buffer size: %u%s.\n"), size, suffix);
+ gdb_printf (_ ("Buffer size: %u%s.\n"), size, suffix);
}
}
@@ -522,7 +510,7 @@ record_btrace_print_pt_conf (const struct btrace_config_pt *conf)
if (size > 0)
{
suffix = record_btrace_adjust_size (&size);
- gdb_printf (_("Buffer size: %u%s.\n"), size, suffix);
+ gdb_printf (_ ("Buffer size: %u%s.\n"), size, suffix);
}
}
@@ -531,7 +519,7 @@ record_btrace_print_pt_conf (const struct btrace_config_pt *conf)
static void
record_btrace_print_conf (const struct btrace_config *conf)
{
- gdb_printf (_("Recording format: %s.\n"),
+ gdb_printf (_ ("Recording format: %s.\n"),
btrace_format_string (conf->format));
switch (conf->format)
@@ -548,7 +536,7 @@ record_btrace_print_conf (const struct btrace_config *conf)
return;
}
- internal_error (_("Unknown branch trace format."));
+ internal_error (_ ("Unknown branch trace format."));
}
/* The info_record method of target record-btrace. */
@@ -564,7 +552,7 @@ record_btrace_target::info_record ()
DEBUG ("info");
if (inferior_ptid == null_ptid)
- error (_("No thread."));
+ error (_ ("No thread."));
tp = inferior_thread ();
@@ -602,13 +590,13 @@ record_btrace_target::info_record ()
gaps = btinfo->ngaps;
}
- gdb_printf (_("Recorded %u instructions in %u functions (%u gaps) "
- "for thread %s (%s).\n"), insns, calls, gaps,
- print_thread_id (tp),
+ gdb_printf (_ ("Recorded %u instructions in %u functions (%u gaps) "
+ "for thread %s (%s).\n"),
+ insns, calls, gaps, print_thread_id (tp),
target_pid_to_str (tp->ptid).c_str ());
if (btrace_is_replaying (tp))
- gdb_printf (_("Replay in progress. At instruction %u.\n"),
+ gdb_printf (_ ("Replay in progress. At instruction %u.\n"),
btrace_insn_number (btinfo->replay));
}
@@ -620,16 +608,16 @@ btrace_ui_out_decode_error (struct ui_out *uiout, int errcode,
{
const char *errstr = btrace_decode_error (format, errcode);
- uiout->text (_("["));
+ uiout->text (_ ("["));
/* ERRCODE > 0 indicates notifications on BTRACE_FORMAT_PT. */
if (!(format == BTRACE_FORMAT_PT && errcode > 0))
{
- uiout->text (_("decode error ("));
+ uiout->text (_ ("decode error ("));
uiout->field_signed ("errcode", errcode);
- uiout->text (_("): "));
+ uiout->text (_ ("): "));
}
uiout->text (errstr);
- uiout->text (_("]\n"));
+ uiout->text (_ ("]\n"));
}
/* A range of source lines. */
@@ -693,8 +681,7 @@ static int
btrace_line_range_contains_range (struct btrace_line_range lhs,
struct btrace_line_range rhs)
{
- return ((lhs.symtab == rhs.symtab)
- && (lhs.begin <= rhs.begin)
+ return ((lhs.symtab == rhs.symtab) && (lhs.begin <= rhs.begin)
&& (rhs.end <= lhs.end));
}
@@ -798,7 +785,7 @@ btrace_insn_history (struct ui_out *uiout,
gdb_pretty_print_disassembler disasm (gdbarch, uiout);
for (btrace_insn_iterator it = *begin; btrace_insn_cmp (&it, end) != 0;
- btrace_insn_next (&it, 1))
+ btrace_insn_next (&it, 1))
{
const struct btrace_insn *insn;
@@ -814,8 +801,7 @@ btrace_insn_history (struct ui_out *uiout,
/* We have trace so we must have a configuration. */
gdb_assert (conf != NULL);
- uiout->field_fmt ("insn-number", "%u",
- btrace_insn_number (&it));
+ uiout->field_fmt ("insn-number", "%u", btrace_insn_number (&it));
uiout->text ("\t");
btrace_ui_out_decode_error (uiout, btrace_insn_get_error (&it),
@@ -833,8 +819,8 @@ btrace_insn_history (struct ui_out *uiout,
if (!btrace_line_range_is_empty (lines)
&& !btrace_line_range_contains_range (last_lines, lines))
{
- btrace_print_lines (lines, uiout, &src_and_asm_tuple, &asm_list,
- flags);
+ btrace_print_lines (lines, uiout, &src_and_asm_tuple,
+ &asm_list, flags);
last_lines = lines;
}
else if (!src_and_asm_tuple.has_value ())
@@ -878,7 +864,7 @@ record_btrace_target::insn_history (int size, gdb_disassembly_flags flags)
ui_out_emit_tuple tuple_emitter (uiout, "insn history");
context = abs (size);
if (context == 0)
- error (_("Bad record instruction-history-size."));
+ error (_ ("Bad record instruction-history-size."));
btinfo = require_btrace ();
history = btinfo->insn_history;
@@ -938,9 +924,9 @@ record_btrace_target::insn_history (int size, gdb_disassembly_flags flags)
else
{
if (size < 0)
- gdb_printf (_("At the start of the branch trace record.\n"));
+ gdb_printf (_ ("At the start of the branch trace record.\n"));
else
- gdb_printf (_("At the end of the branch trace record.\n"));
+ gdb_printf (_ ("At the end of the branch trace record.\n"));
}
btrace_set_insn_history (btinfo, &begin, &end);
@@ -967,16 +953,16 @@ record_btrace_target::insn_history_range (ULONGEST from, ULONGEST to,
/* Check for wrap-arounds. */
if (low != from || high != to)
- error (_("Bad range."));
+ error (_ ("Bad range."));
if (high < low)
- error (_("Bad range."));
+ error (_ ("Bad range."));
btinfo = require_btrace ();
found = btrace_find_insn_by_number (&begin, btinfo, low);
if (found == 0)
- error (_("Range out of bounds."));
+ error (_ ("Range out of bounds."));
found = btrace_find_insn_by_number (&end, btinfo, high);
if (found == 0)
@@ -1004,7 +990,7 @@ record_btrace_target::insn_history_from (ULONGEST from, int size,
context = abs (size);
if (context == 0)
- error (_("Bad record instruction-history-size."));
+ error (_ ("Bad record instruction-history-size."));
if (size < 0)
{
@@ -1053,8 +1039,8 @@ btrace_call_history_insn_range (struct ui_out *uiout,
result from inlining or macro expansion. */
static void
-btrace_compute_src_line_range (const struct btrace_function *bfun,
- int *pbegin, int *pend)
+btrace_compute_src_line_range (const struct btrace_function *bfun, int *pbegin,
+ int *pend)
{
struct symtab *symtab;
struct symbol *sym;
@@ -1081,7 +1067,7 @@ btrace_compute_src_line_range (const struct btrace_function *bfun,
end = std::max (end, sal.line);
}
- out:
+out:
*pbegin = begin;
*pend = end;
}
@@ -1099,8 +1085,7 @@ btrace_call_history_src_line (struct ui_out *uiout,
if (sym == NULL)
return;
- uiout->field_string ("file",
- symtab_to_filename_for_display (sym->symtab ()),
+ uiout->field_string ("file", symtab_to_filename_for_display (sym->symtab ()),
file_name_style.style ());
btrace_compute_src_line_range (bfun, &begin, &end);
@@ -1145,8 +1130,7 @@ static void
btrace_call_history (struct ui_out *uiout,
const struct btrace_thread_info *btinfo,
const struct btrace_call_iterator *begin,
- const struct btrace_call_iterator *end,
- int int_flags)
+ const struct btrace_call_iterator *end, int int_flags)
{
struct btrace_call_iterator it;
record_print_flags flags = (enum record_print_flag) int_flags;
@@ -1198,18 +1182,17 @@ btrace_call_history (struct ui_out *uiout,
uiout->field_string ("function", msym->print_name (),
function_name_style.style ());
else if (!uiout->is_mi_like_p ())
- uiout->field_string ("function", "??",
- function_name_style.style ());
+ uiout->field_string ("function", "??", function_name_style.style ());
if ((flags & RECORD_PRINT_INSN_RANGE) != 0)
{
- uiout->text (_("\tinst "));
+ uiout->text (_ ("\tinst "));
btrace_call_history_insn_range (uiout, bfun);
}
if ((flags & RECORD_PRINT_SRC_LINE) != 0)
{
- uiout->text (_("\tat "));
+ uiout->text (_ ("\tat "));
btrace_call_history_src_line (uiout, bfun);
}
@@ -1232,7 +1215,7 @@ record_btrace_target::call_history (int size, record_print_flags flags)
ui_out_emit_tuple tuple_emitter (uiout, "insn history");
context = abs (size);
if (context == 0)
- error (_("Bad record function-call-history-size."));
+ error (_ ("Bad record function-call-history-size."));
btinfo = require_btrace ();
history = btinfo->call_history;
@@ -1267,7 +1250,7 @@ record_btrace_target::call_history (int size, record_print_flags flags)
else
{
covered = btrace_call_next (&end, context);
- covered += btrace_call_prev (&begin, context- covered);
+ covered += btrace_call_prev (&begin, context - covered);
}
}
else
@@ -1295,9 +1278,9 @@ record_btrace_target::call_history (int size, record_print_flags flags)
else
{
if (size < 0)
- gdb_printf (_("At the start of the branch trace record.\n"));
+ gdb_printf (_ ("At the start of the branch trace record.\n"));
else
- gdb_printf (_("At the end of the branch trace record.\n"));
+ gdb_printf (_ ("At the end of the branch trace record.\n"));
}
btrace_set_call_history (btinfo, &begin, &end);
@@ -1324,16 +1307,16 @@ record_btrace_target::call_history_range (ULONGEST from, ULONGEST to,
/* Check for wrap-arounds. */
if (low != from || high != to)
- error (_("Bad range."));
+ error (_ ("Bad range."));
if (high < low)
- error (_("Bad range."));
+ error (_ ("Bad range."));
btinfo = require_btrace ();
found = btrace_find_call_by_number (&begin, btinfo, low);
if (found == 0)
- error (_("Range out of bounds."));
+ error (_ ("Range out of bounds."));
found = btrace_find_call_by_number (&end, btinfo, high);
if (found == 0)
@@ -1361,7 +1344,7 @@ record_btrace_target::call_history_from (ULONGEST from, int size,
context = abs (size);
if (context == 0)
- error (_("Bad record function-call-history-size."));
+ error (_ ("Bad record function-call-history-size."));
if (size < 0)
{
@@ -1382,7 +1365,7 @@ record_btrace_target::call_history_from (ULONGEST from, int size,
end = ULONGEST_MAX;
}
- call_history_range ( begin, end, flags);
+ call_history_range (begin, end, flags);
}
/* The record_method method of target record-btrace. */
@@ -1394,7 +1377,7 @@ record_btrace_target::record_method (ptid_t ptid)
thread_info *const tp = find_thread_ptid (proc_target, ptid);
if (tp == NULL)
- error (_("No thread."));
+ error (_ ("No thread."));
if (tp->btrace.target == NULL)
return RECORD_METHOD_NONE;
@@ -1455,7 +1438,8 @@ record_btrace_target::xfer_partial (enum target_object object,
{
/* Check if the section we found is readonly. */
if ((bfd_section_flags (section->the_bfd_section)
- & SEC_READONLY) != 0)
+ & SEC_READONLY)
+ != 0)
{
/* Truncate the request to fit into this section. */
len = std::min (len, section->endaddr - offset);
@@ -1545,7 +1529,7 @@ record_btrace_target::fetch_registers (struct regcache *regcache, int regno)
case. */
thread_info *tp = find_thread_ptid (regcache->target (), regcache->ptid ());
if (tp != nullptr)
- replay = tp->btrace.replay;
+ replay = tp->btrace.replay;
if (replay != nullptr && !record_btrace_generating_corefile)
{
@@ -1578,7 +1562,7 @@ record_btrace_target::store_registers (struct regcache *regcache, int regno)
{
if (!record_btrace_generating_corefile
&& record_is_replaying (regcache->ptid ()))
- error (_("Cannot write registers while replaying."));
+ error (_ ("Cannot write registers while replaying."));
gdb_assert (may_write_registers);
@@ -1729,8 +1713,7 @@ record_btrace_frame_this_id (frame_info_ptr this_frame, void **this_cache,
static struct value *
record_btrace_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
- int regnum)
+ void **this_cache, int regnum)
{
const struct btrace_frame_cache *cache;
const struct btrace_function *bfun, *caller;
@@ -1743,7 +1726,7 @@ record_btrace_frame_prev_register (frame_info_ptr this_frame,
pcreg = gdbarch_pc_regnum (gdbarch);
if (pcreg < 0 || regnum != pcreg)
throw_error (NOT_AVAILABLE_ERROR,
- _("Registers are not available in btrace record history"));
+ _ ("Registers are not available in btrace record history"));
cache = (const struct btrace_frame_cache *) *this_cache;
bfun = cache->bfun;
@@ -1751,7 +1734,7 @@ record_btrace_frame_prev_register (frame_info_ptr this_frame,
if (btrace_find_call_by_number (&it, &cache->tp->btrace, bfun->up) == 0)
throw_error (NOT_AVAILABLE_ERROR,
- _("No caller in btrace record history"));
+ _ ("No caller in btrace record history"));
caller = btrace_call_get (&it);
@@ -1774,8 +1757,7 @@ record_btrace_frame_prev_register (frame_info_ptr this_frame,
static int
record_btrace_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
const struct btrace_function *bfun;
struct btrace_frame_cache *cache;
@@ -1887,29 +1869,25 @@ record_btrace_frame_dealloc_cache (frame_info *self, void *this_cache)
Therefore this unwinder reports any possibly unwound registers as
<unavailable>. */
-const struct frame_unwind record_btrace_frame_unwind =
-{
- "record-btrace",
- NORMAL_FRAME,
- record_btrace_frame_unwind_stop_reason,
- record_btrace_frame_this_id,
- record_btrace_frame_prev_register,
- NULL,
- record_btrace_frame_sniffer,
- record_btrace_frame_dealloc_cache
-};
-
-const struct frame_unwind record_btrace_tailcall_frame_unwind =
-{
- "record-btrace tailcall",
- TAILCALL_FRAME,
- record_btrace_frame_unwind_stop_reason,
- record_btrace_frame_this_id,
- record_btrace_frame_prev_register,
- NULL,
- record_btrace_tailcall_frame_sniffer,
- record_btrace_frame_dealloc_cache
-};
+const struct frame_unwind record_btrace_frame_unwind
+ = { "record-btrace",
+ NORMAL_FRAME,
+ record_btrace_frame_unwind_stop_reason,
+ record_btrace_frame_this_id,
+ record_btrace_frame_prev_register,
+ NULL,
+ record_btrace_frame_sniffer,
+ record_btrace_frame_dealloc_cache };
+
+const struct frame_unwind record_btrace_tailcall_frame_unwind
+ = { "record-btrace tailcall",
+ TAILCALL_FRAME,
+ record_btrace_frame_unwind_stop_reason,
+ record_btrace_frame_this_id,
+ record_btrace_frame_prev_register,
+ NULL,
+ record_btrace_tailcall_frame_sniffer,
+ record_btrace_frame_dealloc_cache };
/* Implement the get_unwinder method. */
@@ -1998,9 +1976,9 @@ get_thread_current_frame_id (struct thread_info *tp)
bool executing = tp->executing ();
set_executing (proc_target, inferior_ptid, false);
SCOPE_EXIT
- {
- set_executing (proc_target, inferior_ptid, executing);
- };
+ {
+ set_executing (proc_target, inferior_ptid, executing);
+ };
return get_frame_id (get_current_frame ());
}
@@ -2017,7 +1995,7 @@ record_btrace_start_replaying (struct thread_info *tp)
/* We can't start replaying without trace. */
if (btinfo->functions.empty ())
- error (_("No trace."));
+ error (_ ("No trace."));
/* GDB stores the current frame_id when stepping in order to detects steps
into subroutines.
@@ -2048,7 +2026,7 @@ record_btrace_start_replaying (struct thread_info *tp)
steps = btrace_insn_prev (replay, 1);
if (steps == 0)
- error (_("No trace."));
+ error (_ ("No trace."));
}
/* We're not replaying, yet. */
@@ -2201,8 +2179,7 @@ record_btrace_cancel_resume (struct thread_info *tp)
if (flags == 0)
return;
- DEBUG ("cancel resume thread %s (%s): %x (%s)",
- print_thread_id (tp),
+ DEBUG ("cancel resume thread %s (%s): %x (%s)", print_thread_id (tp),
tp->ptid.to_string ().c_str (), flags.raw (),
btrace_thread_flag_to_str (flags));
@@ -2439,7 +2416,7 @@ record_btrace_step_thread (struct thread_info *tp)
switch (flags)
{
default:
- internal_error (_("invalid stepping type."));
+ internal_error (_ ("invalid stepping type."));
case BTHR_STOP:
return btrace_step_stopped_on_request ();
@@ -2486,12 +2463,13 @@ record_btrace_step_thread (struct thread_info *tp)
/* Announce further events if necessary. */
static void
-record_btrace_maybe_mark_async_event
- (const std::vector<thread_info *> &moving,
- const std::vector<thread_info *> &no_history)
+record_btrace_maybe_mark_async_event (
+ const std::vector<thread_info *> &moving,
+ const std::vector<thread_info *> &no_history)
{
bool more_moving = !moving.empty ();
- bool more_no_history = !no_history.empty ();;
+ bool more_no_history = !no_history.empty ();
+ ;
if (!more_moving && !more_no_history)
return;
@@ -2517,8 +2495,7 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status,
/* Clear this, if needed we'll re-mark it below. */
clear_async_event_handler (record_btrace_async_inferior_event_handler);
- DEBUG ("wait %s (0x%x)", ptid.to_string ().c_str (),
- (unsigned) options);
+ DEBUG ("wait %s (0x%x)", ptid.to_string ().c_str (), (unsigned) options);
/* As long as we're not replaying, just forward the request. */
if ((::execution_direction != EXEC_REVERSE)
@@ -2626,10 +2603,8 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status,
/* We moved the replay position but did not update registers. */
registers_changed_thread (eventing);
- DEBUG ("wait ended by thread %s (%s): %s",
- print_thread_id (eventing),
- eventing->ptid.to_string ().c_str (),
- status->to_string ().c_str ());
+ DEBUG ("wait ended by thread %s (%s): %s", print_thread_id (eventing),
+ eventing->ptid.to_string ().c_str (), status->to_string ().c_str ());
return eventing->ptid;
}
@@ -2658,7 +2633,7 @@ record_btrace_target::stop (ptid_t ptid)
tp->btrace.flags |= BTHR_STOP;
}
}
- }
+}
/* The can_execute_reverse method of target record-btrace. */
@@ -2798,7 +2773,7 @@ record_btrace_target::goto_record_begin ()
steps = btrace_insn_next (&begin, 1);
if (steps == 0)
- error (_("No trace."));
+ error (_ ("No trace."));
}
record_btrace_set_replay (tp, &begin);
@@ -2830,7 +2805,7 @@ record_btrace_target::goto_record (ULONGEST insn)
/* Check for wrap-arounds. */
if (number != insn)
- error (_("Instruction number out of range."));
+ error (_ ("Instruction number out of range."));
tp = require_btrace_thread ();
@@ -2838,7 +2813,7 @@ record_btrace_target::goto_record (ULONGEST insn)
/* Check if the instruction could not be found or is a gap. */
if (found == 0 || btrace_insn_get (&it) == NULL)
- error (_("No such instruction."));
+ error (_ ("No such instruction."));
record_btrace_set_replay (tp, &it);
}
@@ -2882,7 +2857,7 @@ static void
cmd_record_btrace_bts_start (const char *args, int from_tty)
{
if (args != NULL && *args != 0)
- error (_("Invalid argument."));
+ error (_ ("Invalid argument."));
record_btrace_conf.format = BTRACE_FORMAT_BTS;
@@ -2903,7 +2878,7 @@ static void
cmd_record_btrace_pt_start (const char *args, int from_tty)
{
if (args != NULL && *args != 0)
- error (_("Invalid argument."));
+ error (_ ("Invalid argument."));
record_btrace_conf.format = BTRACE_FORMAT_PT;
@@ -2924,7 +2899,7 @@ static void
cmd_record_btrace_start (const char *args, int from_tty)
{
if (args != NULL && *args != 0)
- error (_("Invalid argument."));
+ error (_ ("Invalid argument."));
record_btrace_conf.format = BTRACE_FORMAT_PT;
@@ -2954,8 +2929,7 @@ static void
cmd_show_replay_memory_access (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Replay memory access is %s.\n"),
- replay_memory_access);
+ gdb_printf (file, _ ("Replay memory access is %s.\n"), replay_memory_access);
}
/* The "set record btrace cpu none" command. */
@@ -2964,7 +2938,7 @@ static void
cmd_set_record_btrace_cpu_none (const char *args, int from_tty)
{
if (args != nullptr && *args != 0)
- error (_("Trailing junk: '%s'."), args);
+ error (_ ("Trailing junk: '%s'."), args);
record_btrace_cpu_state = CS_NONE;
}
@@ -2975,7 +2949,7 @@ static void
cmd_set_record_btrace_cpu_auto (const char *args, int from_tty)
{
if (args != nullptr && *args != 0)
- error (_("Trailing junk: '%s'."), args);
+ error (_ ("Trailing junk: '%s'."), args);
record_btrace_cpu_state = CS_AUTO;
}
@@ -2990,31 +2964,32 @@ cmd_set_record_btrace_cpu (const char *args, int from_tty)
/* We use a hard-coded vendor string for now. */
unsigned int family, model, stepping;
- int l1, l2, matches = sscanf (args, "intel: %u/%u%n/%u%n", &family,
- &model, &l1, &stepping, &l2);
+ int l1, l2,
+ matches = sscanf (args, "intel: %u/%u%n/%u%n", &family, &model, &l1,
+ &stepping, &l2);
if (matches == 3)
{
if (strlen (args) != l2)
- error (_("Trailing junk: '%s'."), args + l2);
+ error (_ ("Trailing junk: '%s'."), args + l2);
}
else if (matches == 2)
{
if (strlen (args) != l1)
- error (_("Trailing junk: '%s'."), args + l1);
+ error (_ ("Trailing junk: '%s'."), args + l1);
stepping = 0;
}
else
- error (_("Bad format. See \"help set record btrace cpu\"."));
+ error (_ ("Bad format. See \"help set record btrace cpu\"."));
if (USHRT_MAX < family)
- error (_("Cpu family too big."));
+ error (_ ("Cpu family too big."));
if (UCHAR_MAX < model)
- error (_("Cpu model too big."));
+ error (_ ("Cpu model too big."));
if (UCHAR_MAX < stepping)
- error (_("Cpu stepping too big."));
+ error (_ ("Cpu stepping too big."));
record_btrace_cpu.vendor = CV_INTEL;
record_btrace_cpu.family = family;
@@ -3030,16 +3005,16 @@ static void
cmd_show_record_btrace_cpu (const char *args, int from_tty)
{
if (args != nullptr && *args != 0)
- error (_("Trailing junk: '%s'."), args);
+ error (_ ("Trailing junk: '%s'."), args);
switch (record_btrace_cpu_state)
{
case CS_AUTO:
- gdb_printf (_("btrace cpu is 'auto'.\n"));
+ gdb_printf (_ ("btrace cpu is 'auto'.\n"));
return;
case CS_NONE:
- gdb_printf (_("btrace cpu is 'none'.\n"));
+ gdb_printf (_ ("btrace cpu is 'none'.\n"));
return;
case CS_CPU:
@@ -3047,19 +3022,17 @@ cmd_show_record_btrace_cpu (const char *args, int from_tty)
{
case CV_INTEL:
if (record_btrace_cpu.stepping == 0)
- gdb_printf (_("btrace cpu is 'intel: %u/%u'.\n"),
- record_btrace_cpu.family,
- record_btrace_cpu.model);
+ gdb_printf (_ ("btrace cpu is 'intel: %u/%u'.\n"),
+ record_btrace_cpu.family, record_btrace_cpu.model);
else
- gdb_printf (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
- record_btrace_cpu.family,
- record_btrace_cpu.model,
+ gdb_printf (_ ("btrace cpu is 'intel: %u/%u/%u'.\n"),
+ record_btrace_cpu.family, record_btrace_cpu.model,
record_btrace_cpu.stepping);
return;
}
}
- error (_("Internal error: bad cpu state."));
+ error (_ ("Internal error: bad cpu state."));
}
/* The "record bts buffer-size" show value function. */
@@ -3069,8 +3042,7 @@ show_record_bts_buffer_size_value (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- gdb_printf (file, _("The record/replay bts buffer size is %s.\n"),
- value);
+ gdb_printf (file, _ ("The record/replay bts buffer size is %s.\n"), value);
}
/* The "record pt buffer-size" show value function. */
@@ -3080,64 +3052,63 @@ show_record_pt_buffer_size_value (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- gdb_printf (file, _("The record/replay pt buffer size is %s.\n"),
- value);
+ gdb_printf (file, _ ("The record/replay pt buffer size is %s.\n"), value);
}
/* Initialize btrace commands. */
void _initialize_record_btrace ();
+
void
_initialize_record_btrace ()
{
cmd_list_element *record_btrace_cmd
= add_prefix_cmd ("btrace", class_obscure, cmd_record_btrace_start,
- _("Start branch trace recording."),
+ _ ("Start branch trace recording."),
&record_btrace_cmdlist, 0, &record_cmdlist);
add_alias_cmd ("b", record_btrace_cmd, class_obscure, 1, &record_cmdlist);
cmd_list_element *record_btrace_bts_cmd
- = add_cmd ("bts", class_obscure, cmd_record_btrace_bts_start,
- _("\
+ = add_cmd ("bts", class_obscure, cmd_record_btrace_bts_start, _ ("\
Start branch trace recording in Branch Trace Store (BTS) format.\n\n\
The processor stores a from/to record for each branch into a cyclic buffer.\n\
This format may not be available on all processors."),
- &record_btrace_cmdlist);
+ &record_btrace_cmdlist);
add_alias_cmd ("bts", record_btrace_bts_cmd, class_obscure, 1,
&record_cmdlist);
cmd_list_element *record_btrace_pt_cmd
- = add_cmd ("pt", class_obscure, cmd_record_btrace_pt_start,
- _("\
+ = add_cmd ("pt", class_obscure, cmd_record_btrace_pt_start, _ ("\
Start branch trace recording in Intel Processor Trace format.\n\n\
This format may not be available on all processors."),
- &record_btrace_cmdlist);
- add_alias_cmd ("pt", record_btrace_pt_cmd, class_obscure, 1, &record_cmdlist);
+ &record_btrace_cmdlist);
+ add_alias_cmd ("pt", record_btrace_pt_cmd, class_obscure, 1,
+ &record_cmdlist);
- add_setshow_prefix_cmd ("btrace", class_support,
- _("Set record options."),
- _("Show record options."),
+ add_setshow_prefix_cmd ("btrace", class_support, _ ("Set record options."),
+ _ ("Show record options."),
&set_record_btrace_cmdlist,
- &show_record_btrace_cmdlist,
- &set_record_cmdlist, &show_record_cmdlist);
+ &show_record_btrace_cmdlist, &set_record_cmdlist,
+ &show_record_cmdlist);
add_setshow_enum_cmd ("replay-memory-access", no_class,
- replay_memory_access_types, &replay_memory_access, _("\
-Set what memory accesses are allowed during replay."), _("\
+ replay_memory_access_types, &replay_memory_access,
+ _ ("\
+Set what memory accesses are allowed during replay."),
+ _ ("\
Show what memory accesses are allowed during replay."),
- _("Default is READ-ONLY.\n\n\
+ _ ("Default is READ-ONLY.\n\n\
The btrace record target does not trace data.\n\
The memory therefore corresponds to the live target and not \
to the current replay position.\n\n\
When READ-ONLY, allow accesses to read-only memory during replay.\n\
When READ-WRITE, allow accesses to read-only and read-write memory during \
replay."),
- NULL, cmd_show_replay_memory_access,
- &set_record_btrace_cmdlist,
- &show_record_btrace_cmdlist);
+ NULL, cmd_show_replay_memory_access,
+ &set_record_btrace_cmdlist,
+ &show_record_btrace_cmdlist);
- add_prefix_cmd ("cpu", class_support, cmd_set_record_btrace_cpu,
- _("\
+ add_prefix_cmd ("cpu", class_support, cmd_set_record_btrace_cpu, _ ("\
Set the cpu to be used for trace decode.\n\n\
The format is \"VENDOR:IDENTIFIER\" or \"none\" or \"auto\" (default).\n\
For vendor \"intel\" the format is \"FAMILY/MODEL[/STEPPING]\".\n\n\
@@ -3146,25 +3117,24 @@ The default is \"auto\", which uses the cpu on which the trace was recorded.\n\
When GDB does not support that cpu, this option can be used to enable\n\
workarounds for a similar cpu that GDB supports.\n\n\
When set to \"none\", errata workarounds are disabled."),
- &set_record_btrace_cpu_cmdlist,
- 1,
+ &set_record_btrace_cpu_cmdlist, 1,
&set_record_btrace_cmdlist);
- add_cmd ("auto", class_support, cmd_set_record_btrace_cpu_auto, _("\
+ add_cmd ("auto", class_support, cmd_set_record_btrace_cpu_auto, _ ("\
Automatically determine the cpu to be used for trace decode."),
&set_record_btrace_cpu_cmdlist);
- add_cmd ("none", class_support, cmd_set_record_btrace_cpu_none, _("\
+ add_cmd ("none", class_support, cmd_set_record_btrace_cpu_none, _ ("\
Do not enable errata workarounds for trace decode."),
&set_record_btrace_cpu_cmdlist);
- add_cmd ("cpu", class_support, cmd_show_record_btrace_cpu, _("\
+ add_cmd ("cpu", class_support, cmd_show_record_btrace_cpu, _ ("\
Show the cpu to be used for trace decode."),
&show_record_btrace_cmdlist);
add_setshow_prefix_cmd ("bts", class_support,
- _("Set record btrace bts options."),
- _("Show record btrace bts options."),
+ _ ("Set record btrace bts options."),
+ _ ("Show record btrace bts options."),
&set_record_btrace_bts_cmdlist,
&show_record_btrace_bts_cmdlist,
&set_record_btrace_cmdlist,
@@ -3172,21 +3142,22 @@ Show the cpu to be used for trace decode."),
add_setshow_uinteger_cmd ("buffer-size", no_class,
&record_btrace_conf.bts.size,
- _("Set the record/replay bts buffer size."),
- _("Show the record/replay bts buffer size."), _("\
+ _ ("Set the record/replay bts buffer size."),
+ _ ("Show the record/replay bts buffer size."),
+ _ ("\
When starting recording request a trace buffer of this size. \
The actual buffer size may differ from the requested size. \
Use \"info record\" to see the actual buffer size.\n\n\
Bigger buffers allow longer recording but also take more time to process \
the recorded execution trace.\n\n\
-The trace buffer size may not be changed while recording."), NULL,
- show_record_bts_buffer_size_value,
+The trace buffer size may not be changed while recording."),
+ NULL, show_record_bts_buffer_size_value,
&set_record_btrace_bts_cmdlist,
&show_record_btrace_bts_cmdlist);
add_setshow_prefix_cmd ("pt", class_support,
- _("Set record btrace pt options."),
- _("Show record btrace pt options."),
+ _ ("Set record btrace pt options."),
+ _ ("Show record btrace pt options."),
&set_record_btrace_pt_cmdlist,
&show_record_btrace_pt_cmdlist,
&set_record_btrace_cmdlist,
@@ -3194,19 +3165,20 @@ The trace buffer size may not be changed while recording."), NULL,
add_setshow_uinteger_cmd ("buffer-size", no_class,
&record_btrace_conf.pt.size,
- _("Set the record/replay pt buffer size."),
- _("Show the record/replay pt buffer size."), _("\
+ _ ("Set the record/replay pt buffer size."),
+ _ ("Show the record/replay pt buffer size."), _ ("\
Bigger buffers allow longer recording but also take more time to process \
the recorded execution.\n\
The actual buffer size may differ from the requested size. Use \"info record\" \
-to see the actual buffer size."), NULL, show_record_pt_buffer_size_value,
+to see the actual buffer size."),
+ NULL, show_record_pt_buffer_size_value,
&set_record_btrace_pt_cmdlist,
&show_record_btrace_pt_cmdlist);
add_target (record_btrace_target_info, record_btrace_target_open);
- bfcache = htab_create_alloc (50, bfcache_hash, bfcache_eq, NULL,
- xcalloc, xfree);
+ bfcache
+ = htab_create_alloc (50, bfcache_hash, bfcache_eq, NULL, xcalloc, xfree);
record_btrace_conf.bts.size = 64 * 1024;
record_btrace_conf.pt.size = 16 * 1024;