diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 869f98df38..ca287c46cb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +Tue Apr 11 13:46:25 1995 Jim Kingdon + + * utils.c, defs.h (warning_begin): Renamed from warning_setup, for + consistency with error_begin. Also print warning_pre_print. + Document it better. + * utils.c (warning): Use it. + * utils.c (error_begin): Doc fix. + * rs6000-nat.c (vmap_ldinfo): If symfile_objfile is not part of + any vmap, nuke it. + Tue Apr 11 09:35:20 1995 Jim Kingdon (kingdon@lioth.cygnus.com) * printcmd.c (print_address_numeric): Pass use_local to diff --git a/gdb/defs.h b/gdb/defs.h index 884d5ad248..9bce3c48e9 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -211,11 +211,9 @@ extern void fputs_filtered PARAMS ((const char *, GDB_FILE *)); extern void fputs_unfiltered PARAMS ((const char *, GDB_FILE *)); -extern void fputc_unfiltered PARAMS ((int, GDB_FILE *)); +extern int fputc_unfiltered PARAMS ((int c, GDB_FILE *)); -extern void putc_unfiltered PARAMS ((int)); - -#define putchar_unfiltered(C) putc_unfiltered(C) +extern int putchar_unfiltered PARAMS ((int c)); extern void puts_filtered PARAMS ((char *)); @@ -541,6 +539,10 @@ extern char *reg_names[]; extern char *error_pre_print; +/* Message to be printed before the error message, when an error occurs. */ + +extern char *quit_pre_print; + /* Message to be printed before the warning message, when a warning occurs. */ extern char *warning_pre_print; @@ -573,7 +575,7 @@ return_to_top_level PARAMS ((enum return_reason)) ATTR_NORETURN; extern int catch_errors PARAMS ((int (*) (char *), void *, char *, return_mask)); -extern void warning_setup PARAMS ((void)); +extern void warning_begin PARAMS ((void)); extern void warning (); @@ -596,7 +598,9 @@ extern void psignal PARAMS ((unsigned, const char *)); extern int fclose (); +#ifndef atof extern double atof (); +#endif #ifndef MALLOC_INCOMPATIBLE @@ -740,25 +744,6 @@ extern void set_endian_from_file PARAMS ((bfd *)); #endif /* defined (TARGET_BYTE_ORDER_SELECTABLE) */ #endif /* BITS_BIG_ENDIAN not defined. */ -/* Swap LEN bytes at BUFFER between target and host byte-order. */ -#define SWAP_TARGET_AND_HOST(buffer,len) \ - do \ - { \ - if (TARGET_BYTE_ORDER != HOST_BYTE_ORDER) \ - { \ - char tmp; \ - char *p = (char *)(buffer); \ - char *q = ((char *)(buffer)) + len - 1; \ - for (; p < q; p++, q--) \ - { \ - tmp = *q; \ - *q = *p; \ - *p = tmp; \ - } \ - } \ - } \ - while (0) - /* In findvar.c. */ extern LONGEST extract_signed_integer PARAMS ((void *, int)); diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 8b92b6f379..5a4274d054 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -546,6 +546,31 @@ vmap_ldinfo (ldi) } while (ldi->ldinfo_next && (ldi = (void *) (ldi->ldinfo_next + (char *) ldi))); + /* If we don't find the symfile_objfile anywhere in the ldinfo, it + is unlikely that the symbol file is relocated to the proper + address. And we might have attached to a process which is + running a different copy of the same executable. */ + for (got_one = 0, vp = vmap; vp != NULL; vp = vp->nxt) + { + if (symfile_objfile == vp->objfile) + { + got_one = 1; + break; + } + } + if (symfile_objfile != NULL && !got_one) + { + warning_begin (); + fputs_unfiltered ("Symbol file ", gdb_stderr); + fputs_unfiltered (symfile_objfile->name, gdb_stderr); + fputs_unfiltered ("\nis not mapped; discarding it.\n\ +If in fact that file has symbols which the mapped files listed by\n\ +\"info files\" lack, you can load symbols with the \"symbol-file\" or\n\ +\"add-symbol-file\" commands (note that you must take care of relocating\n\ +symbols to the proper address).\n", gdb_stderr); + free_objfile (symfile_objfile); + symfile_objfile = NULL; + } } /* As well as symbol tables, exec_sections need relocation. After diff --git a/gdb/utils.c b/gdb/utils.c index 8277a97f71..dd3c746d77 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -223,23 +223,30 @@ null_cleanup (arg) } -/* Provide a hook for modules wishing to print their own warning messages - to set up the terminal state in a compatible way, without them having - to import all the target_<...> macros. */ +/* Print a warning message. Way to use this is to call warning_begin, + output the warning message (use unfiltered output to gdb_stderr), + ending in a newline. There is not currently a warning_end that you + call afterwards, but such a thing might be added if it is useful + for a GUI to separate warning messages from other output. + + FIXME: Why do warnings use unfiltered output and errors filtered? + Is this anything other than a historical accident? */ void -warning_setup () +warning_begin () { target_terminal_ours (); wrap_here(""); /* Force out any buffered output */ gdb_flush (gdb_stdout); + if (warning_pre_print) + fprintf_unfiltered (gdb_stderr, warning_pre_print); } /* Print a warning message. The first argument STRING is the warning message, used as a fprintf string, and the remaining args are passed as arguments to it. The primary difference between warnings and errors is that a warning - does not force the return to command level. */ + does not force the return to command level. */ /* VARARGS */ void @@ -250,11 +257,7 @@ warning (va_alist) char *string; va_start (args); - target_terminal_ours (); - wrap_here(""); /* Force out any buffered output */ - gdb_flush (gdb_stdout); - if (warning_pre_print) - fprintf_unfiltered (gdb_stderr, warning_pre_print); + warning_begin (); string = va_arg (args, char *); vfprintf_unfiltered (gdb_stderr, string, args); fprintf_unfiltered (gdb_stderr, "\n"); @@ -262,10 +265,12 @@ warning (va_alist) } /* Start the printing of an error message. Way to use this is to call - this, output the error message (use filtered output), and then call - return_to_top_level (RETURN_ERROR). error() provides a convenient way to - do this for the special case that the error message can be formatted with - a single printf call, but this is more general. */ + this, output the error message (use filtered output to gdb_stderr + (FIXME: Some callers, like memory_error, use gdb_stdout)), ending + in a newline, and then call return_to_top_level (RETURN_ERROR). + error() provides a convenient way to do this for the special case + that the error message can be formatted with a single printf call, + but this is more general. */ void error_begin () {