aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorThomas Lord <lord@cygnus>1993-11-01 22:25:23 +0000
committerThomas Lord <lord@cygnus>1993-11-01 22:25:23 +0000
commit199b2450f62ad6ffbe56ec34fc447716b811579d (patch)
tree07400f3981865f129b912a51b85e69b7b8d1ee22 /gdb/source.c
parentb3c0fc577b17083c8bdc3ed5cffc4ca50aefaa5e (diff)
downloadgdb-199b2450f62ad6ffbe56ec34fc447716b811579d.zip
gdb-199b2450f62ad6ffbe56ec34fc447716b811579d.tar.gz
gdb-199b2450f62ad6ffbe56ec34fc447716b811579d.tar.bz2
Change the stream argument to _filtered to GDB_FILE *.
Change all references to stdout/stderr to gdb_stdout/gdb_stderr. Replace all calls to stdio output functions with calls to corresponding _unfiltered functions (`fprintf_unfiltered') Replaced calls to fopen for output to gdb_fopen. Added sufficient goo to utils.c and defs.h to make the above work. The net effect is that stdio output functions are only directly used in utils.c. Elsewhere, the _unfiltered and _filtered functions and GDB_FILE type are used. In the near future, GDB_FILE will stop being equivalant to FILE. The semantics of some commands has changed in a very subtle way: called in the right context, they may cause new occurences of prompt_for_continue() behavior. The testsuite doesn't notice anything like this, though. Please respect this change by not reintroducing stdio output dependencies in the main body of gdb code. All output from commands should go to a GDB_FILE. Target-specific code can still use stdio directly to communicate with targets.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/gdb/source.c b/gdb/source.c
index 581eabc..5a4733f 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -363,7 +363,7 @@ mod_path (dirname, which_path)
if (stat (name, &st) < 0)
{
int save_errno = errno;
- fprintf (stderr, "Warning: ");
+ fprintf_unfiltered (gdb_stderr, "Warning: ");
print_sys_errmsg (name, save_errno);
}
else if ((st.st_mode & S_IFMT) != S_IFDIR)
@@ -804,10 +804,10 @@ identify_source_line (s, line, mid_statement, pc)
if (line > s->nlines)
/* Don't index off the end of the line_charpos array. */
return 0;
- printf ("\032\032%s:%d:%d:%s:0x%x\n", s->fullname,
+ printf_unfiltered ("\032\032%s:%d:%d:%s:0x%lx\n", s->fullname,
line, s->line_charpos[line - 1],
mid_statement ? "middle" : "beg",
- pc);
+ (unsigned long) pc);
current_source_line = line;
first_line_listed = line;
last_line_listed = line;
@@ -961,7 +961,7 @@ list_command (arg, from_tty)
dummy_beg = 1;
else
{
- sals = decode_line_1 (&arg1, 0, 0, 0);
+ sals = decode_line_1 (&arg1, 0, 0, 0, 0);
if (! sals.nelts) return; /* C++ */
if (sals.nelts > 1)
@@ -993,9 +993,9 @@ list_command (arg, from_tty)
else
{
if (dummy_beg)
- sals_end = decode_line_1 (&arg1, 0, 0, 0);
+ sals_end = decode_line_1 (&arg1, 0, 0, 0, 0);
else
- sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line);
+ sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0);
if (sals_end.nelts == 0)
return;
if (sals_end.nelts > 1)
@@ -1025,17 +1025,19 @@ list_command (arg, from_tty)
if (*arg == '*')
{
if (sal.symtab == 0)
- error ("No source file for address %s.", local_hex_string(sal.pc));
+ error ("No source file for address %s.",
+ local_hex_string((unsigned long) sal.pc));
sym = find_pc_function (sal.pc);
if (sym)
{
- printf_filtered ("%s is in ", local_hex_string(sal.pc));
- fputs_filtered (SYMBOL_SOURCE_NAME (sym), stdout);
+ printf_filtered ("%s is in ",
+ local_hex_string((unsigned long) sal.pc));
+ fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout);
printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
}
else
printf_filtered ("%s is at %s:%d.\n",
- local_hex_string(sal.pc),
+ local_hex_string((unsigned long) sal.pc),
sal.symtab->filename, sal.line);
}
@@ -1116,7 +1118,7 @@ line_info (arg, from_tty)
address. */
printf_filtered (" for address ");
wrap_here (" ");
- print_address (sal.pc, stdout);
+ print_address (sal.pc, gdb_stdout);
}
else
printf_filtered (".");
@@ -1131,7 +1133,7 @@ line_info (arg, from_tty)
sal.line, sal.symtab->filename);
wrap_here (" ");
printf_filtered (" is at address ");
- print_address (start_pc, stdout);
+ print_address (start_pc, gdb_stdout);
wrap_here (" ");
printf_filtered (" but contains no code.\n");
}
@@ -1141,10 +1143,10 @@ line_info (arg, from_tty)
sal.line, sal.symtab->filename);
wrap_here (" ");
printf_filtered (" starts at address ");
- print_address (start_pc, stdout);
+ print_address (start_pc, gdb_stdout);
wrap_here (" ");
printf_filtered (" and ends at ");
- print_address (end_pc, stdout);
+ print_address (end_pc, gdb_stdout);
printf_filtered (".\n");
}
@@ -1166,6 +1168,7 @@ line_info (arg, from_tty)
printf_filtered ("Line number %d is out of range for \"%s\".\n",
sal.line, sal.symtab->filename);
}
+ free (sals.sals);
}
/* Commands to search the source file for a regexp. */
@@ -1328,6 +1331,12 @@ _initialize_source ()
current_source_symtab = 0;
init_source_path ();
+ /* The intention is to use POSIX Basic Regular Expressions.
+ Always use the GNU regex routine for consistency across all hosts.
+ Our current GNU regex.c does not have all the POSIX features, so this is
+ just an approximation. */
+ re_set_syntax (RE_SYNTAX_GREP);
+
c = add_cmd ("directory", class_files, directory_command,
"Add directory DIR to beginning of search path for source files.\n\
Forget cached info on source file locations and line positions.\n\