/* Skipping uninteresting files and functions while stepping.
- Copyright (C) 2011-2019 Free Software Foundation, Inc.
+ Copyright (C) 2011-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "gdb_regex.h"
#include "gdbsupport/gdb_optional.h"
#include <list>
+#include "cli/cli-style.h"
/* True if we want to print debug printouts related to file/function
skipping. */
-static int debug_skip = 0;
+static bool debug_skip = false;
class skiplist_entry
{
if (m_function_is_regexp)
{
gdb_assert (!m_function.empty ());
-
- int flags = REG_NOSUB;
-#ifdef REG_EXTENDED
- flags |= REG_EXTENDED;
-#endif
-
- gdb_assert (!m_function.empty ());
- m_compiled_function_regexp.emplace (m_function.c_str (), flags,
+ m_compiled_function_regexp.emplace (m_function.c_str (),
+ REG_NOSUB | REG_EXTENDED,
_("regexp"));
}
}
if (symtab == NULL)
error (_("No default file now."));
- /* It is not a typo, symtab_to_filename_for_display woule be needlessly
+ /* It is not a typo, symtab_to_filename_for_display would be needlessly
ambiguous. */
filename = symtab_to_fullname (symtab);
}
/* Default to the current function if no argument is given. */
if (arg == NULL)
{
+ frame_info *fi = get_selected_frame (_("No default function now."));
+ struct symbol *sym = get_frame_function (fi);
const char *name = NULL;
- CORE_ADDR pc;
-
- if (!last_displayed_sal_is_valid ())
- error (_("No default function now."));
- pc = get_last_displayed_addr ();
- if (!find_pc_partial_function (pc, &name, NULL, NULL))
- {
- error (_("No function found containing current program point %s."),
- paddress (get_current_arch (), pc));
- }
+ if (sym != NULL)
+ name = sym->print_name ();
+ else
+ error (_("No function found containing current program point %s."),
+ paddress (get_current_arch (), get_frame_pc (fi)));
skip_function (name);
return;
}
current_uiout->field_string ("file",
e.file ().empty () ? "<none>"
: e.file ().c_str (),
- ui_out_style_kind::FILE); /* 4 */
+ e.file ().empty ()
+ ? metadata_style.style ()
+ : file_name_style.style ()); /* 4 */
if (e.function_is_regexp ())
current_uiout->field_string ("regexp", "y"); /* 5 */
else
current_uiout->field_string ("function",
e.function ().empty () ? "<none>"
: e.function ().c_str (),
- ui_out_style_kind::FUNCTION); /* 6 */
+ e.function ().empty ()
+ ? metadata_style.style ()
+ : function_name_style.style ()); /* 6 */
current_uiout->text ("\n");
}
if (m_function_is_regexp)
{
if (debug_skip)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"skip: checking if function %s matches regex %s...",
function_name, m_function.c_str ());
else
{
if (debug_skip)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
("skip: checking if function %s matches non-regex "
"%s..."),
function_name, m_function.c_str ());
}
}
+void _initialize_step_skip ();
void
-_initialize_step_skip (void)
+_initialize_step_skip ()
{
static struct cmd_list_element *skiplist = NULL;
struct cmd_list_element *c;
FUNCTION-SPEC is one of:\n\
-fu|-function FUNCTION-NAME\n\
-rfu|-rfunction FUNCTION-NAME-REGULAR-EXPRESSION"),
- &skiplist, "skip ", 1, &cmdlist);
+ &skiplist, 1, &cmdlist);
c = add_cmd ("file", class_breakpoint, skip_file_command, _("\
Ignore a file while stepping.\n\