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"
55#define OPEN_MODE (O_RDONLY | O_BINARY)
56#define FDOPEN_MODE FOPEN_RB
133 _(
"Number of source lines gdb "
134 "will list by default is %s.\n"),
244 cursal.symtab =
loc->symtab ();
245 cursal.line =
loc->line ();
264 error (_(
"No symbol table is loaded. Use the \"file\" command."));
268 if (
loc->symtab () ==
nullptr)
284 cursal.
pspace = sal.pspace;
290 loc->set (sal.symtab, sal.line);
304 loc->set (
nullptr, 0);
321 if (
loc->symtab () !=
nullptr)
351 int len = strlen (
name);
353 if (!(len > 2 && (strcmp (&
name[len - 2],
".h") == 0
354 || strcmp (
name,
"<<C++-namespaces>>") == 0)))
376 error (_(
"Can't find a default source file"));
396 if (!set_path.empty ())
407 gdb_puts (
"Source directories searched: ", file);
428 for (
symtab *s : cu->filetabs ())
430 if (s->fullname != NULL)
459 source_path = string_printf (
"$cdir%c$cwd", DIRNAME_SEPARATOR);
468 bool value_changed =
false;
473 if (!from_tty ||
query (_(
"Reinitialize source path to empty? ")))
476 value_changed =
true;
483 value_changed =
true;
506mod_path (
const char *dirname, std::string &which_path)
518add_path (
const char *dirname,
char **which_path,
int parse_separators)
520 char *old = *which_path;
522 std::vector<gdb::unique_xmalloc_ptr<char>> dir_vec;
527 if (parse_separators)
531 gdb_argv argv (dirname);
533 for (
char *arg : argv)
534 dirnames_to_char_ptr_vec_append (&dir_vec, arg);
537 dir_vec.emplace_back (xstrdup (dirname));
539 for (
const gdb::unique_xmalloc_ptr<char> &name_up : dir_vec)
541 const char *
name = name_up.get ();
544 std::string new_name_holder;
549 p = name_up.get () + strlen (
name);
551 while (!(IS_DIR_SEPARATOR (*
name) && p <=
name + 1)
552#ifdef HAVE_DOS_BASED_FILE_SYSTEM
554 && !(p ==
name + 3 &&
name[1] ==
':')
557 && IS_DIR_SEPARATOR (p[-1]))
562 while (p >
name && p[-1] ==
'.')
567 name = current_directory;
570 else if (p >
name + 1 && IS_DIR_SEPARATOR (p[-2]))
594 = gdb::unique_xmalloc_ptr<char[]> (tilde_expand (
name)).get ();
595#ifdef HAVE_DOS_BASED_FILE_SYSTEM
596 else if (IS_ABSOLUTE_PATH (
name) && p ==
name + 2)
597 new_name_holder = std::string (
name) +
".";
599 else if (!IS_ABSOLUTE_PATH (
name) &&
name[0] !=
'$')
600 new_name_holder = gdb_abspath (
name);
602 new_name_holder = std::string (
name, p -
name);
604 name = new_name_holder.c_str ();
618 if (stat (
name, &st) < 0)
620 int save_errno = errno;
625 else if ((st.st_mode & S_IFMT) != S_IFDIR)
626 warning (_(
"%s is not a directory."),
name);
631 unsigned int len = strlen (
name);
640 if (!filename_ncmp (p,
name, len)
641 && (p[len] ==
'\0' || p[len] == DIRNAME_SEPARATOR))
649 if (
prefix > p - *which_path)
655 memmove (p, &p[len + 1], strlen (&p[len + 1]) + 1);
657 p = strchr (p, DIRNAME_SEPARATOR);
664 tinybuf[0] = DIRNAME_SEPARATOR;
672 std::string temp = std::string (old,
prefix) + tinybuf +
name;
673 *which_path = concat (temp.c_str (), &old[
prefix],
679 *which_path = concat (
name, (old[0] ? tinybuf : old),
695add_path (
const char *dirname, std::string &which_path,
int parse_separators)
697 char *which_path_copy = xstrdup (which_path.data ());
698 add_path (dirname, &which_path_copy, parse_separators);
699 which_path = which_path_copy;
700 xfree (which_path_copy);
723 const std::vector<off_t> *offsets;
725 gdb_printf (_(
"Contains %d line%s.\n"), (
int) offsets->size (),
726 offsets->size () == 1 ?
"" :
"s");
732 ? cust->
producer () : _(
"unknown"));
733 gdb_printf (_(
"Compiled with %s debugging format.\n"),
735 gdb_printf (_(
"%s preprocessor macro info.\n"),
737 ?
"Includes" :
"Does not include"));
750 if (HAS_DRIVE_SPEC (path))
751 path = STRIP_DRIVE_SPEC (path);
753 const char *old_path;
759 while (IS_DIR_SEPARATOR(path[0]))
763 while (path[0] ==
'.' && IS_DIR_SEPARATOR (path[1]))
766 while (old_path != path);
805openp (
const char *path, openp_flags opts,
const char *
string,
806 int mode, gdb::unique_xmalloc_ptr<char> *filename_opened)
814 std::vector<gdb::unique_xmalloc_ptr<char>> dir_vec;
817 gdb_assert ((mode & O_CREAT) == 0);
818 gdb_assert (
string != NULL);
827 if (
string[0] ==
'\0')
840 int i, reg_file_errno;
842 if (is_regular_file (
string, ®_file_errno))
844 filename = (
char *) alloca (strlen (
string) + 1);
845 strcpy (filename,
string);
846 fd = gdb_open_cloexec (filename, mode, 0).release ();
855 last_errno = reg_file_errno;
859 for (i = 0;
string[i]; i++)
860 if (IS_DIR_SEPARATOR (
string[i]))
868 alloclen = strlen (path) + strlen (
string) + 2;
869 filename = (
char *) alloca (alloclen);
873 dir_vec = dirnames_to_char_ptr_vec (path);
875 for (
const gdb::unique_xmalloc_ptr<char> &dir_up : dir_vec)
877 char *dir = dir_up.get ();
878 size_t len = strlen (dir);
881 if (strcmp (dir,
"$cwd") == 0)
887 len = strlen (current_directory);
888 newlen = len + strlen (
string) + 2;
889 if (newlen > alloclen)
892 filename = (
char *) alloca (alloclen);
894 strcpy (filename, current_directory);
896 else if (strchr(dir,
'~'))
901 gdb::unique_xmalloc_ptr<char> tilde_expanded (tilde_expand (dir));
904 len = strlen (tilde_expanded.get ());
905 newlen = len + strlen (
string) + 2;
906 if (newlen > alloclen)
909 filename = (
char *) alloca (alloclen);
911 strcpy (filename, tilde_expanded.get ());
916 strcpy (filename, dir);
925 if (strcmp (dir,
"$cdir") == 0)
930 while (len > 0 && IS_DIR_SEPARATOR (filename[len - 1]))
933 strcat (filename + len, SLASH_STRING);
934 strcat (filename,
string);
936 if (is_regular_file (filename, ®_file_errno))
938 fd = gdb_open_cloexec (filename, mode, 0).release ();
944 last_errno = reg_file_errno;
952 filename_opened->reset (NULL);
954 *filename_opened = gdb_realpath (filename);
957 = make_unique_xstrdup (gdb_abspath (filename).c_str ());
978 gdb::unique_xmalloc_ptr<char> *full_pathname)
984 filename, O_RDONLY, full_pathname);
987 full_pathname->reset (NULL);
1002 const int from_len = rule->
from.length ();
1003 const int path_len = strlen (path);
1005 if (path_len < from_len)
1011 if (filename_ncmp (path, rule->
from.c_str (), from_len) != 0)
1018 if (path[from_len] !=
'\0' && !IS_DIR_SEPARATOR (path[from_len]))
1043gdb::unique_xmalloc_ptr<char>
1048 if (rule ==
nullptr)
1053 return (gdb::unique_xmalloc_ptr<char>
1054 (concat (rule->
to.c_str (), path + rule->
from.length (),
nullptr)));
1061 const char *dirname,
1062 gdb::unique_xmalloc_ptr<char> *fullname)
1065 std::string expanded_path_holder;
1072 return scoped_fd (-1);
1080 gdb::unique_xmalloc_ptr<char> rewritten_fullname
1083 if (rewritten_fullname != NULL)
1084 *fullname = std::move (rewritten_fullname);
1086 scoped_fd result = gdb_open_cloexec (fullname->get (),
OPEN_MODE, 0);
1087 if (result.get () >= 0)
1089 *fullname = gdb_realpath (fullname->get ());
1094 fullname->reset (NULL);
1097 gdb::unique_xmalloc_ptr<char> rewritten_dirname;
1098 if (dirname != NULL)
1105 if (rewritten_dirname != NULL)
1106 dirname = rewritten_dirname.get ();
1112 if (p && (p == path || p[-1] == DIRNAME_SEPARATOR)
1118 expanded_path_holder =
source_path.substr (0, len);
1121 expanded_path_holder += dirname;
1126 path = expanded_path_holder.c_str ();
1130 gdb::unique_xmalloc_ptr<char> rewritten_filename
1133 if (rewritten_filename != NULL)
1134 filename = rewritten_filename.get ();
1139 if (result < 0 && dirname != NULL)
1149 std::string cdir_filename = path_join (dirname, filename_start);
1152 cdir_filename.c_str (),
OPEN_MODE, fullname);
1157 p = lbasename (filename);
1163 return scoped_fd (result);
1175 return scoped_fd (-1);
1177 gdb::unique_xmalloc_ptr<char> fullname (s->
fullname);
1188 std::string srcpath;
1189 if (IS_ABSOLUTE_PATH (s->
filename))
1194 srcpath += SLASH_STRING;
1198 const struct bfd_build_id *build_id
1202 if (build_id !=
nullptr && !srcpath.empty ())
1216gdb::unique_xmalloc_ptr<char>
1219 gdb::unique_xmalloc_ptr<char> fullname;
1227 if (dirname ==
nullptr || IS_ABSOLUTE_PATH (filename))
1228 fullname.reset (xstrdup (filename));
1230 fullname.reset (concat (dirname, SLASH_STRING,
1231 filename, (
char *)
nullptr));
1233 gdb::unique_xmalloc_ptr<char> rewritten
1235 if (rewritten !=
nullptr)
1236 fullname = std::move (rewritten);
1263 gdb::unique_xmalloc_ptr<char> fullname;
1270 fullname.reset (xstrdup (s->
filename));
1296 internal_error (_(
"invalid filename_display_string"));
1306 print_source_lines_flags
flags)
1308 bool noprint =
false;
1309 int nlines = stopline - line;
1353 int len = strlen (filename) + 100;
1354 char *
name = (
char *) alloca (len);
1356 xsnprintf (
name, len,
"%d\t%s", line, filename);
1362 uiout->
text (
"\tin ");
1374 char *local_fullname;
1379 local_fullname = (
char *) alloca (strlen (s_fullname) + 1);
1380 strcpy (local_fullname, s_fullname);
1393 if (stopline <= line)
1399 const std::vector<off_t> *offsets =
nullptr;
1401 error (_(
"Line number %d out of range; %s has %d lines."),
1403 offsets ==
nullptr ? 0 : (int) offsets->size ());
1406 const char *iter = lines.c_str ();
1407 int new_lineno =
loc->line ();
1408 while (nlines-- > 0 && *iter !=
'\0')
1418 xsnprintf (buf,
sizeof (buf),
"%d\t", new_lineno++);
1421 while (*iter !=
'\0')
1426 const char *start = iter;
1434 else if (c >= 0 && c < 040 && c !=
'\t')
1443 std::string
text (start, iter);
1454 else if (*iter ==
'\n')
1459 else if (*iter > 0 && *iter < 040)
1461 xsnprintf (buf,
sizeof (buf),
"^%c", *iter + 0100);
1465 else if (*iter == 0177)
1474 loc->set (
loc->symtab (), new_lineno);
1482 print_source_lines_flags
flags)
1491 print_source_lines_flags
flags)
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)
1636 const std::vector<off_t> *offsets;
1639 || line > offsets->size ())
1640 error (_(
"Expression not found"));
1642 if (lseek (desc.get (), (*offsets)[line - 1], 0) < 0)
1646 clearerr (stream.get ());
1648 gdb::def_vector<char> buf;
1655 int c = fgetc (stream.get ());
1662 while (c !=
'\n' && (c = fgetc (stream.get ())) >= 0);
1666 size_t sz = buf.size ();
1667 if (sz >= 2 && buf[sz - 2] ==
'\r')
1670 buf.resize (sz - 1);
1674 buf.push_back (
'\0');
1675 if (re_exec (buf.data ()) > 0)
1691 if (fseek (stream.get (), (*offsets)[line - 1], 0) < 0)
1693 const char *filename
1720 const int last = strlen (path) - 1;
1725 if (IS_DIR_SEPARATOR (path[last]))
1745 gdb_argv argv (args);
1749 if (argv != NULL && argv[0] != NULL && argv[1] != NULL)
1750 error (_(
"Too many arguments in command"));
1752 if (argv != NULL && argv[0] != NULL)
1759 (_(
"Source path substitution rule matching `%s':\n"), from);
1761 gdb_printf (_(
"List of all source path substitution rules:\n"));
1766 gdb_printf (
" `%s' -> `%s'.\n", rule.from.c_str (),
1776 gdb_argv argv (args);
1781 if (argv != NULL && argv[0] != NULL && argv[1] != NULL)
1782 error (_(
"Incorrect usage, too many arguments in command"));
1784 if (argv != NULL && argv[0] != NULL)
1792 && !
query (_(
"Delete all source path substitution rules? ")))
1793 error (_(
"Canceled"));
1798 if (from ==
nullptr)
1807 return FILENAME_CMP (from,
1808 rule.from.c_str ()) == 0;
1817 error (_(
"No substitution rule defined for `%s'"), from);
1828 gdb_argv argv (args);
1830 if (argv == NULL || argv[0] == NULL || argv [1] == NULL)
1831 error (_(
"Incorrect usage, too few arguments in command"));
1833 if (argv[2] != NULL)
1834 error (_(
"Incorrect usage, too many arguments in command"));
1836 if (*(argv[0]) ==
'\0')
1837 error (_(
"First argument must be at least one character long"));
1852 return FILENAME_CMP (argv[0], rule.from.c_str ()) == 0;
1916 re_set_syntax (RE_SYNTAX_GREP);
1920Add directory DIR to beginning of search path for source files.\n\
1921Forget cached info on source file locations and line positions.\n\
1922DIR can also be $cwd for the current working directory, or $cdir for the\n\
1923directory in which the source file was compiled into object code.\n\
1924With no argument, reset the search path to $cdir:$cwd, the default."),
1933Set the search path for finding source files."),
1935Show the search path for finding source files."),
1937$cwd in the path means the current working directory.\n\
1938$cdir in the path means the compilation directory of the source file.\n\
1939GDB ensures the search path always ends with $cdir:$cwd by\n\
1940appending these directories if necessary.\n\
1941Setting the value to an empty string sets it to $cdir:$cwd, the default."),
1947 _(
"Information about the current source file."));
1950Core addresses of the code for a source line.\n\
1951Line can be specified as\n\
1952 LINENUM, to list around that line in current file,\n\
1953 FILE:LINENUM, to list around that line in that file,\n\
1954 FUNCTION, to list around beginning of that function,\n\
1955 FILE:FUNCTION, to distinguish among like-named static functions.\n\
1956Default is to describe the last source line that was listed.\n\n\
1957This sets the default address for \"x\" to the line's first instruction\n\
1958so that \"x/i\" suffices to start examining the machine code.\n\
1959The address is also stored as the value of \"$_\"."));
1963Search for regular expression (see regex(3)) from last line listed.\n\
1964The matching line number is also stored as the value of \"$_\"."));
1970Search backward for regular expression (see regex(3)) from last line listed.\n\
1971The matching line number is also stored as the value of \"$_\"."));
1975Set number of source lines gdb will list by default."), _(
"\
1976Show number of source lines gdb will list by default."), _(
"\
1977Use this to choose how many source lines the \"list\" displays (unless\n\
1978the \"list\" argument explicitly specifies some other number).\n\
1979A value of \"unlimited\", or zero, means there's no limit."),
1986Add a substitution rule to rewrite the source directories.\n\
1987Usage: set substitute-path FROM TO\n\
1988The rule is applied only if the directory name starts with FROM\n\
1989directly followed by a directory separator.\n\
1990If a substitution rule was previously set for FROM, the old rule\n\
1991is replaced by the new one."),
1996Delete one or all substitution rules rewriting the source directories.\n\
1997Usage: unset substitute-path [FROM]\n\
1998Delete the rule for substituting FROM in source directories. If FROM\n\
1999is not specified, all substituting rules are deleted.\n\
2000If the debugger cannot find a rule for FROM, it will display a warning."),
2005Show one or all substitution rules rewriting the source directories.\n\
2006Usage: show substitute-path [FROM]\n\
2007Print the rule for substituting FROM in source directories. If FROM\n\
2008is not specified, print all substitution rules."),
2014Set how to display filenames."), _(
"\
2015Show how to display filenames."), _(
"\
2016filename-display can be:\n\
2017 basename - display only basename of a filename\n\
2018 relative - display a filename relative to the compilation directory\n\
2019 absolute - display an absolute filename\n\
2020By default, relative filenames are displayed."),
2026 _(
"Generic command for setting how sources are handled."),
2030 _(
"Generic command for showing source settings."),
2034Set whether GDB should open source files."), _(
"\
2035Show whether GDB should open source files."), _(
"\
2036When this option is on GDB will open source files and display the\n\
2037contents when appropriate, for example, when GDB stops, or the list\n\
2039When this option is off GDB will not try to open source files, instead\n\
2040GDB will print the file and line number that would have been displayed.\n\
2041This can be useful if access to source code files is slow, for example\n\
2042due 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_integer_cmd(const char *name, enum command_class theclass, int *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_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)
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
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
observable< const char *, const char * > command_param_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)
void select_source_symtab(struct symtab *s)
static const char *const filename_display_kind_names[]
void forget_cached_source_info_for_objfile(struct objfile *objfile)
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)
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 program_space * pspace
struct symtab * find_last_source_symtab()
compunit_symtab_range compunits()
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)
bool skip_ansi_escape(const char *buf, int *n_read)
void perror_with_name(const char *string)
int query(const char *ctlstr,...)
void print_sys_errmsg(const char *string, int errcode)
void gdb_printf(struct ui_file *stream, const char *format,...)
void gdb_puts(const char *linebuffer, struct ui_file *stream)
struct internalvar * lookup_internalvar(const char *name)
void set_internalvar_integer(struct internalvar *var, LONGEST l)