29#include "gdbsupport/filestuff.h"
34#include "gdbsupport/gdb_regex.h"
43#include "readline/tilde.h"
44#include "gdbsupport/enum-flags.h"
45#include "gdbsupport/scoped_fd.h"
47#include "gdbsupport/pathstuff.h"
53#include "gdbsupport/buildargv.h"
56#define OPEN_MODE (O_RDONLY | O_BINARY)
57#define FDOPEN_MODE FOPEN_RB
134 _(
"Number of source lines gdb "
135 "will list by default is %s.\n"),
245 cursal.symtab =
loc->symtab ();
246 cursal.line =
loc->line ();
265 error (_(
"No symbol table is loaded. Use the \"file\" command."));
269 if (
loc->symtab () ==
nullptr)
285 cursal.
pspace = sal.pspace;
291 loc->set (sal.symtab, sal.line);
305 loc->set (
nullptr, 0);
314 if (
loc->symtab () !=
nullptr)
344 int len = strlen (
name);
346 if (!(len > 2 && (strcmp (&
name[len - 2],
".h") == 0
347 || strcmp (
name,
"<<C++-namespaces>>") == 0)))
369 error (_(
"Can't find a default source file"));
389 if (!set_path.empty ())
400 gdb_puts (
"Source directories searched: ", file);
430 source_path = string_printf (
"$cdir%c$cwd", DIRNAME_SEPARATOR);
439 bool value_changed =
false;
444 if (!from_tty ||
query (_(
"Reinitialize source path to empty? ")))
447 value_changed =
true;
454 value_changed =
true;
477mod_path (
const char *dirname, std::string &which_path)
489add_path (
const char *dirname,
char **which_path,
int parse_separators)
491 char *old = *which_path;
493 std::vector<gdb::unique_xmalloc_ptr<char>> dir_vec;
498 if (parse_separators)
502 gdb_argv argv (dirname);
504 for (
char *arg : argv)
505 dirnames_to_char_ptr_vec_append (&dir_vec, arg);
508 dir_vec.emplace_back (xstrdup (dirname));
510 for (
const gdb::unique_xmalloc_ptr<char> &name_up : dir_vec)
512 const char *
name = name_up.get ();
515 std::string new_name_holder;
520 p = name_up.get () + strlen (
name);
522 while (!(IS_DIR_SEPARATOR (*
name) && p <=
name + 1)
523#ifdef HAVE_DOS_BASED_FILE_SYSTEM
525 && !(p ==
name + 3 &&
name[1] ==
':')
528 && IS_DIR_SEPARATOR (p[-1]))
533 while (p >
name && p[-1] ==
'.')
538 name = current_directory;
541 else if (p >
name + 1 && IS_DIR_SEPARATOR (p[-2]))
565 = gdb::unique_xmalloc_ptr<char[]> (tilde_expand (
name)).get ();
566#ifdef HAVE_DOS_BASED_FILE_SYSTEM
567 else if (IS_ABSOLUTE_PATH (
name) && p ==
name + 2)
568 new_name_holder = std::string (
name) +
".";
570 else if (!IS_ABSOLUTE_PATH (
name) &&
name[0] !=
'$')
571 new_name_holder = gdb_abspath (
name);
573 new_name_holder = std::string (
name, p -
name);
575 name = new_name_holder.c_str ();
589 if (stat (
name, &st) < 0)
591 else if ((st.st_mode & S_IFMT) != S_IFDIR)
592 warning (_(
"%ps is not a directory."),
598 unsigned int len = strlen (
name);
607 if (!filename_ncmp (p,
name, len)
608 && (p[len] ==
'\0' || p[len] == DIRNAME_SEPARATOR))
616 if (
prefix > p - *which_path)
622 memmove (p, &p[len + 1], strlen (&p[len + 1]) + 1);
624 p = strchr (p, DIRNAME_SEPARATOR);
631 tinybuf[0] = DIRNAME_SEPARATOR;
639 std::string temp = std::string (old,
prefix) + tinybuf +
name;
640 *which_path = concat (temp.c_str (), &old[
prefix],
646 *which_path = concat (
name, (old[0] ? tinybuf : old),
662add_path (
const char *dirname, std::string &which_path,
int parse_separators)
664 char *which_path_copy = xstrdup (which_path.data ());
665 add_path (dirname, &which_path_copy, parse_separators);
666 which_path = which_path_copy;
667 xfree (which_path_copy);
690 const std::vector<off_t> *offsets;
692 gdb_printf (_(
"Contains %d line%s.\n"), (
int) offsets->size (),
693 offsets->size () == 1 ?
"" :
"s");
699 ? cust->
producer () : _(
"unknown"));
700 gdb_printf (_(
"Compiled with %s debugging format.\n"),
702 gdb_printf (_(
"%s preprocessor macro info.\n"),
704 ?
"Includes" :
"Does not include"));
717 if (HAS_DRIVE_SPEC (path))
718 path = STRIP_DRIVE_SPEC (path);
720 const char *old_path;
726 while (IS_DIR_SEPARATOR(path[0]))
730 while (path[0] ==
'.' && IS_DIR_SEPARATOR (path[1]))
733 while (old_path != path);
772openp (
const char *path, openp_flags opts,
const char *
string,
773 int mode, gdb::unique_xmalloc_ptr<char> *filename_opened)
781 std::vector<gdb::unique_xmalloc_ptr<char>> dir_vec;
784 gdb_assert ((mode & O_CREAT) == 0);
785 gdb_assert (
string != NULL);
794 if (
string[0] ==
'\0')
807 int i, reg_file_errno;
809 if (is_regular_file (
string, ®_file_errno))
811 filename = (
char *) alloca (strlen (
string) + 1);
812 strcpy (filename,
string);
813 fd = gdb_open_cloexec (filename, mode, 0).release ();
822 last_errno = reg_file_errno;
826 for (i = 0;
string[i]; i++)
827 if (IS_DIR_SEPARATOR (
string[i]))
835 alloclen = strlen (path) + strlen (
string) + 2;
836 filename = (
char *) alloca (alloclen);
840 dir_vec = dirnames_to_char_ptr_vec (path);
842 for (
const gdb::unique_xmalloc_ptr<char> &dir_up : dir_vec)
844 char *dir = dir_up.get ();
845 size_t len = strlen (dir);
848 if (strcmp (dir,
"$cwd") == 0)
854 len = strlen (current_directory);
855 newlen = len + strlen (
string) + 2;
856 if (newlen > alloclen)
859 filename = (
char *) alloca (alloclen);
861 strcpy (filename, current_directory);
863 else if (strchr(dir,
'~'))
868 gdb::unique_xmalloc_ptr<char> tilde_expanded (tilde_expand (dir));
871 len = strlen (tilde_expanded.get ());
872 newlen = len + strlen (
string) + 2;
873 if (newlen > alloclen)
876 filename = (
char *) alloca (alloclen);
878 strcpy (filename, tilde_expanded.get ());
883 strcpy (filename, dir);
892 if (strcmp (dir,
"$cdir") == 0)
897 while (len > 0 && IS_DIR_SEPARATOR (filename[len - 1]))
900 strcat (filename + len, SLASH_STRING);
901 strcat (filename,
string);
903 if (is_regular_file (filename, ®_file_errno))
905 fd = gdb_open_cloexec (filename, mode, 0).release ();
911 last_errno = reg_file_errno;
919 filename_opened->reset (NULL);
921 *filename_opened = gdb_realpath (filename);
924 = make_unique_xstrdup (gdb_abspath (filename).c_str ());
945 gdb::unique_xmalloc_ptr<char> *full_pathname)
951 filename, O_RDONLY, full_pathname);
954 full_pathname->reset (NULL);
969 const int from_len = rule->
from.length ();
970 const int path_len = strlen (path);
972 if (path_len < from_len)
978 if (filename_ncmp (path, rule->
from.c_str (), from_len) != 0)
985 if (path[from_len] !=
'\0' && !IS_DIR_SEPARATOR (path[from_len]))
1010gdb::unique_xmalloc_ptr<char>
1015 if (rule ==
nullptr)
1020 return (gdb::unique_xmalloc_ptr<char>
1021 (concat (rule->
to.c_str (), path + rule->
from.length (),
nullptr)));
1028 const char *dirname,
1029 gdb::unique_xmalloc_ptr<char> *fullname)
1032 std::string expanded_path_holder;
1039 return scoped_fd (-ECANCELED);
1047 gdb::unique_xmalloc_ptr<char> rewritten_fullname
1050 if (rewritten_fullname != NULL)
1051 *fullname = std::move (rewritten_fullname);
1053 scoped_fd result = gdb_open_cloexec (fullname->get (),
OPEN_MODE, 0);
1054 if (result.get () >= 0)
1056 *fullname = gdb_realpath (fullname->get ());
1061 fullname->reset (NULL);
1064 gdb::unique_xmalloc_ptr<char> rewritten_dirname;
1065 if (dirname != NULL)
1072 if (rewritten_dirname != NULL)
1073 dirname = rewritten_dirname.get ();
1079 if (p && (p == path || p[-1] == DIRNAME_SEPARATOR)
1085 expanded_path_holder =
source_path.substr (0, len);
1088 expanded_path_holder += dirname;
1093 path = expanded_path_holder.c_str ();
1097 gdb::unique_xmalloc_ptr<char> rewritten_filename
1100 if (rewritten_filename != NULL)
1101 filename = rewritten_filename.get ();
1106 if (result < 0 && dirname != NULL)
1116 std::string cdir_filename = path_join (dirname, filename_start);
1119 cdir_filename.c_str (),
OPEN_MODE, fullname);
1124 p = lbasename (filename);
1134 return scoped_fd (result);
1146 return scoped_fd (-EINVAL);
1148 gdb::unique_xmalloc_ptr<char> fullname (s->
fullname);
1159 std::string srcpath;
1160 if (IS_ABSOLUTE_PATH (s->
filename))
1165 srcpath += SLASH_STRING;
1169 const struct bfd_build_id *build_id
1173 if (build_id !=
nullptr && !srcpath.empty ())
1183 if (query_fd.get () >= 0)
1198gdb::unique_xmalloc_ptr<char>
1201 gdb::unique_xmalloc_ptr<char> fullname;
1209 if (dirname ==
nullptr || IS_ABSOLUTE_PATH (filename))
1210 fullname.reset (xstrdup (filename));
1212 fullname.reset (concat (dirname, SLASH_STRING,
1213 filename, (
char *)
nullptr));
1215 gdb::unique_xmalloc_ptr<char> rewritten
1217 if (rewritten !=
nullptr)
1218 fullname = std::move (rewritten);
1245 gdb::unique_xmalloc_ptr<char> fullname;
1252 fullname.reset (xstrdup (s->
filename));
1278 internal_error (_(
"invalid filename_display_string"));
1288 print_source_lines_flags
flags)
1290 bool noprint =
false;
1291 int errcode = ENOENT;
1292 int nlines = stopline - line;
1324 errcode = -desc.get ();
1339 warning (_(
"%d\t%ps: %s"), line,
1341 safe_strerror (errcode));
1346 uiout->
text (
"\tin ");
1358 char *local_fullname;
1363 local_fullname = (
char *) alloca (strlen (s_fullname) + 1);
1364 strcpy (local_fullname, s_fullname);
1377 if (stopline <= line)
1383 const std::vector<off_t> *offsets =
nullptr;
1385 error (_(
"Line number %d out of range; %s has %d lines."),
1387 offsets ==
nullptr ? 0 : (int) offsets->size ());
1390 const char *iter = lines.c_str ();
1391 int new_lineno =
loc->line ();
1392 while (nlines-- > 0 && *iter !=
'\0')
1402 xsnprintf (buf,
sizeof (buf),
"%d\t", new_lineno++);
1405 while (*iter !=
'\0')
1410 const char *start = iter;
1418 else if (c >= 0 && c < 040 && c !=
'\t')
1427 std::string
text (start, iter);
1438 else if (*iter ==
'\n')
1443 else if (*iter > 0 && *iter < 040)
1445 xsnprintf (buf,
sizeof (buf),
"^%c", *iter + 0100);
1449 else if (*iter == 0177)
1458 loc->set (
loc->symtab (), new_lineno);
1466 print_source_lines_flags
flags)
1475 print_source_lines_flags
flags)
1486 const std::vector<off_t> *offsets;
1491 if (offsets ==
nullptr)
1494 return offsets->size ();
1504 CORE_ADDR start_pc, end_pc;
1506 std::vector<symtab_and_line> decoded_sals;
1508 gdb::array_view<symtab_and_line> sals;
1527 sals = decoded_sals;
1534 for (
const auto &sal : sals)
1539 if (sal.symtab == 0)
1543 gdb_printf (_(
"No line number information available"));
1557 else if (sal.line > 0
1562 if (start_pc == end_pc)
1602 gdb_printf (_(
"Line number %d is out of range for \"%s\".\n"),
1616 const char *msg =
re_comp (regex);
1618 error ((
"%s"), msg);
1622 if (
loc->symtab () ==
nullptr)
1626 error (_(
"source code access disabled"));
1629 if (desc.get () < 0)
1637 const std::vector<off_t> *offsets;
1640 || line > offsets->size ())
1641 error (_(
"Expression not found"));
1643 if (lseek (desc.get (), (*offsets)[line - 1], 0) < 0)
1647 clearerr (stream.get ());
1649 gdb::def_vector<char> buf;
1656 int c = fgetc (stream.get ());
1663 while (c !=
'\n' && (c = fgetc (stream.get ())) >= 0);
1667 size_t sz = buf.size ();
1668 if (sz >= 2 && buf[sz - 2] ==
'\r')
1671 buf.resize (sz - 1);
1675 buf.push_back (
'\0');
1676 if (re_exec (buf.data ()) > 0)
1692 if (fseek (stream.get (), (*offsets)[line - 1], 0) < 0)
1694 const char *filename
1696 perror_with_name (filename);
1721 const int last = strlen (path) - 1;
1726 if (IS_DIR_SEPARATOR (path[last]))
1746 gdb_argv argv (args);
1750 if (argv != NULL && argv[0] != NULL && argv[1] != NULL)
1751 error (_(
"Too many arguments in command"));
1753 if (argv != NULL && argv[0] != NULL)
1760 (_(
"Source path substitution rule matching `%s':\n"), from);
1762 gdb_printf (_(
"List of all source path substitution rules:\n"));
1767 gdb_printf (
" `%s' -> `%s'.\n", rule.from.c_str (),
1777 gdb_argv argv (args);
1782 if (argv != NULL && argv[0] != NULL && argv[1] != NULL)
1783 error (_(
"Incorrect usage, too many arguments in command"));
1785 if (argv != NULL && argv[0] != NULL)
1793 && !
query (_(
"Delete all source path substitution rules? ")))
1794 error (_(
"Canceled"));
1799 if (from ==
nullptr)
1808 return FILENAME_CMP (from,
1809 rule.from.c_str ()) == 0;
1818 error (_(
"No substitution rule defined for `%s'"), from);
1829 gdb_argv argv (args);
1831 if (argv == NULL || argv[0] == NULL || argv [1] == NULL)
1832 error (_(
"Incorrect usage, too few arguments in command"));
1834 if (argv[2] != NULL)
1835 error (_(
"Incorrect usage, too many arguments in command"));
1837 if (*(argv[0]) ==
'\0')
1838 error (_(
"First argument must be at least one character long"));
1853 return FILENAME_CMP (argv[0], rule.from.c_str ()) == 0;
1917 re_set_syntax (RE_SYNTAX_GREP);
1921Add directory DIR to beginning of search path for source files.\n\
1922Forget cached info on source file locations and line positions.\n\
1923DIR can also be $cwd for the current working directory, or $cdir for the\n\
1924directory in which the source file was compiled into object code.\n\
1925With no argument, reset the search path to $cdir:$cwd, the default."),
1934Set the search path for finding source files."),
1936Show the search path for finding source files."),
1938$cwd in the path means the current working directory.\n\
1939$cdir in the path means the compilation directory of the source file.\n\
1940GDB ensures the search path always ends with $cdir:$cwd by\n\
1941appending these directories if necessary.\n\
1942Setting the value to an empty string sets it to $cdir:$cwd, the default."),
1948 _(
"Information about the current source file."));
1951Core addresses of the code for a source line.\n\
1952Line can be specified as\n\
1953 LINENUM, to list around that line in current file,\n\
1954 FILE:LINENUM, to list around that line in that file,\n\
1955 FUNCTION, to list around beginning of that function,\n\
1956 FILE:FUNCTION, to distinguish among like-named static functions.\n\
1957Default is to describe the last source line that was listed.\n\n\
1958This sets the default address for \"x\" to the line's first instruction\n\
1959so that \"x/i\" suffices to start examining the machine code.\n\
1960The address is also stored as the value of \"$_\"."));
1964Search for regular expression (see regex(3)) from last line listed.\n\
1965The matching line number is also stored as the value of \"$_\"."));
1971Search backward for regular expression (see regex(3)) from last line listed.\n\
1972The matching line number is also stored as the value of \"$_\"."));
1976Set number of source lines gdb will list by default."), _(
"\
1977Show number of source lines gdb will list by default."), _(
"\
1978Use this to choose how many source lines the \"list\" displays (unless\n\
1979the \"list\" argument explicitly specifies some other number).\n\
1980A value of \"unlimited\", or zero, means there's no limit."),
1987Add a substitution rule to rewrite the source directories.\n\
1988Usage: set substitute-path FROM TO\n\
1989The rule is applied only if the directory name starts with FROM\n\
1990directly followed by a directory separator.\n\
1991If a substitution rule was previously set for FROM, the old rule\n\
1992is replaced by the new one."),
1997Delete one or all substitution rules rewriting the source directories.\n\
1998Usage: unset substitute-path [FROM]\n\
1999Delete the rule for substituting FROM in source directories. If FROM\n\
2000is not specified, all substituting rules are deleted.\n\
2001If the debugger cannot find a rule for FROM, it will display a warning."),
2006Show one or all substitution rules rewriting the source directories.\n\
2007Usage: show substitute-path [FROM]\n\
2008Print the rule for substituting FROM in source directories. If FROM\n\
2009is not specified, print all substitution rules."),
2015Set how to display filenames."), _(
"\
2016Show how to display filenames."), _(
"\
2017filename-display can be:\n\
2018 basename - display only basename of a filename\n\
2019 relative - display a filename relative to the compilation directory\n\
2020 absolute - display an absolute filename\n\
2021By default, relative filenames are displayed."),
2027 _(
"Generic command for setting how sources are handled."),
2031 _(
"Generic command for showing source settings."),
2035Set whether GDB should open source files."), _(
"\
2036Show whether GDB should open source files."), _(
"\
2037When this option is on GDB will open source files and display the\n\
2038contents when appropriate, for example, when GDB stops, or the list\n\
2040When this option is off GDB will not try to open source files, instead\n\
2041GDB will print the file and line number that would have been displayed.\n\
2042This can be useful if access to source code files is slow, for example\n\
2043due to the source being located over a slow network connection."),
bool annotate_source_line(struct symtab *s, int line, int mid_statement, CORE_ADDR pc)
struct gdbarch * get_current_arch(void)
const struct bfd_build_id * build_id_bfd_get(bfd *abfd)
ui_file_style style() const
bool get_source_lines(struct symtab *s, int first_line, int last_line, std::string *lines_out)
bool get_line_charpos(struct symtab *s, const std::vector< off_t > **offsets)
source_lines_range(int startline, direction dir=FORWARD)
ui_out_flags test_flags(ui_out_flags mask)
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
void field_signed(const char *fldname, LONGEST value)
void text(const char *string)
bool is_mi_like_p() const
struct cmd_list_element * showlist
struct cmd_list_element * setsourcelist
struct cmd_list_element * cmdlist
struct cmd_list_element * setlist
struct cmd_list_element * showsourcelist
struct cmd_list_element * unsetlist
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
cmd_list_element * add_com_alias(const char *name, cmd_list_element *target, command_class theclass, int abbrev_flag)
set_show_commands add_setshow_optional_filename_cmd(const char *name, enum command_class theclass, std::string *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc)
set_show_commands add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
set_show_commands add_setshow_integer_cmd(const char *name, enum command_class theclass, int *var, const literal_def *extra_literals, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc, struct cmd_list_element **subcommands, int allow_unknown, struct cmd_list_element **list)
set_show_commands add_setshow_boolean_cmd(const char *name, enum command_class theclass, bool *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_info(const char *name, cmd_simple_func_ftype *fun, const char *doc)
cli_style_option file_name_style
void filename_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
scoped_fd debuginfod_source_query(const unsigned char *build_id, int build_id_len, const char *srcpath, gdb::unique_xmalloc_ptr< char > *destname)
EXTERN_C char * re_comp(const char *)
void set_next_address(struct gdbarch *, CORE_ADDR)
void print_address(struct gdbarch *, CORE_ADDR, struct ui_file *)
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
void interps_notify_param_changed(const char *param, const char *value)
const char * language_str(enum language lang)
std::vector< symtab_and_line > decode_line_with_last_displayed(const char *string, int flags)
static struct compunit_symtab * new_symtab(const char *, int, struct objfile *)
observable current_source_symtab_and_line_changed
int have_partial_symbols(void)
int have_full_symbols(void)
#define prefix(a, b, R, do)
struct program_space * current_program_space
std::vector< struct program_space * > program_spaces
source_cache g_source_cache
int openp(const char *path, openp_flags opts, const char *string, int mode, gdb::unique_xmalloc_ptr< char > *filename_opened)
const char * symtab_to_fullname(struct symtab *s)
static const char *const filename_display_kind_names[]
void select_source_symtab()
scoped_fd find_and_open_source(const char *filename, const char *dirname, gdb::unique_xmalloc_ptr< char > *fullname)
static void show_directories_1(ui_file *file, char *ignore, int from_tty)
static void show_directories_command(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
const char * symtab_to_filename_for_display(struct symtab *symtab)
struct symtab_and_line get_current_source_symtab_and_line(void)
static void reverse_search_command(const char *regex, int from_tty)
static void forward_search_command(const char *regex, int from_tty)
static void set_substitute_path_command(const char *args, int from_tty)
static void clear_lines_listed_range(void)
static void strip_trailing_directory_separator(char *path)
static void show_lines_to_list(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void print_source_lines_base(struct symtab *s, int line, int stopline, print_source_lines_flags flags)
void mod_path(const char *dirname, std::string &which_path)
static void show_source_open(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
void clear_current_source_symtab_and_line(void)
static int last_line_listed
static const char filename_display_absolute[]
int get_first_line_listed(void)
void forget_cached_source_info(void)
void _initialize_source()
static void directory_command(const char *dirname, int from_tty)
static int first_line_listed
void directory_switch(const char *dirname, int from_tty)
static const char filename_display_basename[]
scoped_fd open_source_file(struct symtab *s)
void init_source_path(void)
static void show_source(const char *args, int from_tty)
int last_symtab_line(struct symtab *s)
static void unset_substitute_path_command(const char *args, int from_tty)
static const registry< program_space >::key< current_source_location > current_source_key
static void show_substitute_path_command(const char *args, int from_tty)
static const char * prepare_path_for_appending(const char *path)
static struct symtab * last_source_visited
void add_path(const char *dirname, char **which_path, int parse_separators)
static const char * filename_display_string
void set_default_source_symtab_and_line(void)
void print_source_lines(struct symtab *s, int line, int stopline, print_source_lines_flags flags)
static current_source_location * get_source_location(program_space *pspace)
gdb::unique_xmalloc_ptr< char > rewrite_source_path(const char *path)
int get_lines_to_list(void)
gdb::unique_xmalloc_ptr< char > find_source_or_rewrite(const char *filename, const char *dirname)
static void info_line_command(const char *arg, int from_tty)
struct symtab_and_line set_current_source_symtab_and_line(const symtab_and_line &sal)
static struct substitute_path_rule * get_substitute_path_rule(const char *path)
int source_full_path_of(const char *filename, gdb::unique_xmalloc_ptr< char > *full_pathname)
static void info_source_command(const char *ignore, int from_tty)
static void search_command_helper(const char *regex, int from_tty, bool forward)
void add_substitute_path_rule(const char *from, const char *to)
static int substitute_path_rule_matches(const struct substitute_path_rule *rule, const char *path)
static const char filename_display_relative[]
static void set_directories_command(const char *args, int from_tty, struct cmd_list_element *c)
static void set_source(const char *arg, int from_tty)
static void show_filename_display_string(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static std::list< substitute_path_rule > substitute_path_rules
static bool last_source_error
int get_lines_to_list(void)
@ PRINT_SOURCE_LINES_FILENAME
@ PRINT_SOURCE_LINES_NOERROR
struct macro_table * macro_table() const
const char * debugformat() const
struct objfile * objfile() const
const char * dirname() const
const char * producer() const
void set(struct symtab *s, int l)
current_source_location()=default
struct symtab * symtab() const
void forget_cached_source_info()
struct symtab * find_last_source_symtab()
objfiles_range objfiles()
substitute_path_rule(const char *from_, const char *to_)
address_class aclass() const
struct program_space * pspace
enum language language() const
struct compunit_symtab * compunit() const
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
bool find_line_pc_range(struct symtab_and_line sal, CORE_ADDR *startptr, CORE_ADDR *endptr)
symtab_and_line find_function_start_sal(CORE_ADDR func_addr, obj_section *section, bool funfirstline)
static styled_string_s * styled_string(const ui_file_style &style, const char *str, styled_string_s &&tmp={})
bool skip_ansi_escape(const char *buf, int *n_read)
int query(const char *ctlstr,...)
void gdb_printf(struct ui_file *stream, const char *format,...)
void gdb_puts(const char *linebuffer, struct ui_file *stream)
void warning_filename_and_errno(const char *filename, int saved_errno)
struct internalvar * lookup_internalvar(const char *name)
void set_internalvar_integer(struct internalvar *var, LONGEST l)