diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1994-05-13 18:18:57 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1994-05-13 18:18:57 +0000 |
commit | 1c95d7ab2e12e00756d21ef44c7539f8f9edc56f (patch) | |
tree | 1366d0687b8ad6294d7cbb151227f81b4f3280da | |
parent | f3e72e3771ea66fb319fe96b96403ef212dbfb50 (diff) | |
download | gdb-1c95d7ab2e12e00756d21ef44c7539f8f9edc56f.zip gdb-1c95d7ab2e12e00756d21ef44c7539f8f9edc56f.tar.gz gdb-1c95d7ab2e12e00756d21ef44c7539f8f9edc56f.tar.bz2 |
gcc -Wall lint:
* breakpoint.c (watchpoint_check): Remove unused variable b.
* stack.c (print_frame_info): Move sp and buf inside #if.
* eval.c (evaluate_subexp): Remove unused variables pp,
mangle_ptr, ptr, and mangle_tstr.
* valarith.c (value_x_binop): Remove unused variables mangle_tstr
and mangle_ptr.
* symtab.c (lookup_symtab): Put variable copy inside #if.
(decode_line_1): Put variable q1 inside #if 0.
* target.h: Declare target_link.
* infrun.c (wait_for_inferior): Remove unused variables signame.
* remote.c (remote_resume): Remove unused variable name.
* c-exp.y (parse_number): Parenthesize operand of shift.
* dbxread.c (record_minimal_symbol): Parenthesize operand of &&
(this is a semantic change, the warning seems to have detected a bug).
* dbxread.c (end_psymtab): Move variable p1 inside #if.
* coffread.c: Move variable temptype inside #if.
* ch-typeprint.c (chill_type_print_base): Remove unused variable
name.
* ch-valprint.c: #include typeprint.h and ch-lang.h.
(chill_val_print): Remove unused variable in_range.
(chill_val_print): Remove statement "length > TYPE_LENGTH (type);".
(chill_val_print): Add default case for switch.
* stabsread.h: Declare stabsect_build_psymtabs.
* os9kread.c (read_minimal_symbols): Make this return void.
(os9k_symfile_read): Remove unused variables stb_exist and val.
(os9k_symfile_init): Remove unused variable val.
(fill_sym): Remove unused variable id.
(read_os9k_psymtab): Put variable back_to inside #if 0. Remove
unused variable nsl.
Remove unused variable symfile_bfd.
#if 0 unused variables lbrac_unmatched_complaint and
lbrac_mismatch_complaint.
Remove declaration for non-existent function os9k_next_symbol_text.
* annotate.c, annotate.h: New files, containing a function for
each annotation which outputs it.
* Move breakpoints_changed from breakpoint.c to annotate.c.
* breakpoint.c, blockframe.c, infrun.c, cp-valprint.c, main.c,
printcmd.c, source.c, stack.c, utils.c, valprint.c:
Use annotate.c functions to output annotations.
* Makefile.in (OBS): Add annotate.o.
-rw-r--r-- | gdb/.Sanitize | 2 | ||||
-rw-r--r-- | gdb/ChangeLog | 45 | ||||
-rw-r--r-- | gdb/Makefile.in | 28 | ||||
-rw-r--r-- | gdb/annotate.c | 508 | ||||
-rw-r--r-- | gdb/annotate.h | 95 | ||||
-rw-r--r-- | gdb/breakpoint.c | 80 | ||||
-rw-r--r-- | gdb/c-exp.y | 3 | ||||
-rw-r--r-- | gdb/ch-typeprint.c | 1 | ||||
-rw-r--r-- | gdb/ch-valprint.c | 6 | ||||
-rw-r--r-- | gdb/coffread.c | 138 | ||||
-rw-r--r-- | gdb/cp-valprint.c | 17 | ||||
-rw-r--r-- | gdb/infrun.c | 52 | ||||
-rw-r--r-- | gdb/main.c | 5 | ||||
-rw-r--r-- | gdb/os9kread.c | 20 | ||||
-rw-r--r-- | gdb/printcmd.c | 85 | ||||
-rw-r--r-- | gdb/remote.c | 8 | ||||
-rw-r--r-- | gdb/source.c | 16 | ||||
-rw-r--r-- | gdb/stabsread.h | 7 | ||||
-rw-r--r-- | gdb/symtab.c | 19 | ||||
-rw-r--r-- | gdb/target.h | 8 | ||||
-rw-r--r-- | gdb/utils.c | 7 | ||||
-rw-r--r-- | gdb/valprint.c | 31 |
22 files changed, 927 insertions, 254 deletions
diff --git a/gdb/.Sanitize b/gdb/.Sanitize index 610b036..7475b5e 100644 --- a/gdb/.Sanitize +++ b/gdb/.Sanitize @@ -76,6 +76,8 @@ a68v-nat.c alpha-nat.c alpha-tdep.c altos-xdep.c +annotate.c +annotate.h arm-convert.s arm-pinsn.c arm-tdep.c diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fd362cf..8a1ce07 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,48 @@ +Fri May 13 08:10:21 1994 Jim Kingdon (kingdon@lioth.cygnus.com) + + gcc -Wall lint: + * breakpoint.c (watchpoint_check): Remove unused variable b. + * stack.c (print_frame_info): Move sp and buf inside #if. + * eval.c (evaluate_subexp): Remove unused variables pp, + mangle_ptr, ptr, and mangle_tstr. + * valarith.c (value_x_binop): Remove unused variables mangle_tstr + and mangle_ptr. + * symtab.c (lookup_symtab): Put variable copy inside #if. + (decode_line_1): Put variable q1 inside #if 0. + * target.h: Declare target_link. + * infrun.c (wait_for_inferior): Remove unused variables signame. + * remote.c (remote_resume): Remove unused variable name. + * c-exp.y (parse_number): Parenthesize operand of shift. + * dbxread.c (record_minimal_symbol): Parenthesize operand of && + (this is a semantic change, the warning seems to have detected a bug). + * dbxread.c (end_psymtab): Move variable p1 inside #if. + * coffread.c: Move variable temptype inside #if. + * ch-typeprint.c (chill_type_print_base): Remove unused variable + name. + * ch-valprint.c: #include typeprint.h and ch-lang.h. + (chill_val_print): Remove unused variable in_range. + (chill_val_print): Remove statement "length > TYPE_LENGTH (type);". + (chill_val_print): Add default case for switch. + * stabsread.h: Declare stabsect_build_psymtabs. + * os9kread.c (read_minimal_symbols): Make this return void. + (os9k_symfile_read): Remove unused variables stb_exist and val. + (os9k_symfile_init): Remove unused variable val. + (fill_sym): Remove unused variable id. + (read_os9k_psymtab): Put variable back_to inside #if 0. Remove + unused variable nsl. + Remove unused variable symfile_bfd. + #if 0 unused variables lbrac_unmatched_complaint and + lbrac_mismatch_complaint. + Remove declaration for non-existent function os9k_next_symbol_text. + + * annotate.c, annotate.h: New files, containing a function for + each annotation which outputs it. + * Move breakpoints_changed from breakpoint.c to annotate.c. + * breakpoint.c, blockframe.c, infrun.c, cp-valprint.c, main.c, + printcmd.c, source.c, stack.c, utils.c, valprint.c: + Use annotate.c functions to output annotations. + * Makefile.in (OBS): Add annotate.o. + Thu May 12 10:46:27 1994 Jeff Law (law@snake.cs.utah.edu) * hppa-tdep.c (read_unwind_info): Make sure elf_unwind_size and diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 535b984..1ec257d 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -381,8 +381,8 @@ inferior_h = inferior.h $(breakpoint_h) # right, it is probably easiest just to list .h files here directly. HFILES_NO_SRCDIR = buildsym.h call-cmds.h coff-solib.h defs.h dst.h environ.h \ - $(gdbcmd_h) \ - $(gdbcore_h) gdb-stabs.h $(inferior_h) language.h minimon.h monitor.h \ + $(gdbcmd_h) gdbcore.h \ + gdb-stabs.h $(inferior_h) language.h minimon.h monitor.h \ objfiles.h parser-defs.h partial-stab.h serial.h signals.h solib.h \ symfile.h stabsread.h target.h terminal.h typeprint.h xcoffsolib.h \ c-lang.h ch-lang.h m2-lang.h complaints.h ns32k-opcode.h valprint.h \ @@ -400,9 +400,9 @@ HFILES_NO_SRCDIR = buildsym.h call-cmds.h coff-solib.h defs.h dst.h environ.h \ vx-share/xdr_ptrace.h vx-share/xdr_rdb.h thread.h \ dcache.h remote-utils.h remote-sim.h -# Header files that already have srcdir in them. +# Header files that already have srcdir in them, or which are in objdir. -HFILES_WITH_SRCDIR = $(udiheaders) +HFILES_WITH_SRCDIR = $(udiheaders) ../bfd/bfd.h # GDB "info" files, which should be included in their entirety @@ -445,7 +445,7 @@ OBS = version.o main.o blockframe.o breakpoint.o findvar.o stack.o thread.o \ dwarfread.o mipsread.o stabsread.o core.o c-lang.o ch-lang.o m2-lang.o \ complaints.o typeprint.o c-typeprint.o ch-typeprint.o m2-typeprint.o \ c-valprint.o cp-valprint.o ch-valprint.o m2-valprint.o nlmread.o \ - serial.o mdebugread.o os9kread.o + serial.o mdebugread.o os9kread.o annotate.o TSOBS = inflow.o @@ -615,9 +615,6 @@ xm-vaxult.h: xm-vax.h xm-vaxbsd.h: xm-vax.h kdb: $(NTSSTART) $(OBS) $(NTSOBS) $(ADD_DEPS) $(CDEPS) - rm -f init.c - $(srcdir)/munch $(MUNCH_DEFINE) $(OBS) $(NTSOBS) > init.c - $(CC) $(INTERNAL_LDFLAGS) -c init.c $(CLIBS) ld -o kdb $(NTSSTART) $(OBS) $(NTSOBS) init.o $(ADD_FILES) \ -lc $(CLIBS) @@ -889,7 +886,7 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ lynx-nat.c m3-nat.c \ m68k-pinsn.c m68k-tdep.c \ m88k-nat.c m88k-pinsn.c m88k-tdep.c mips-nat.c mips-pinsn.c \ - mips-tdep.c mipsm3-nat.c news-xdep.c \ + mips-tdep.c mipsm3-nat.c mipsv4-nat.c news-xdep.c \ nindy-share/Onindy.c nindy-share/nindy.c \ nindy-share/ttyflush.c nindy-tdep.c \ ns32k-pinsn.c ns32km3-nat.c osfsolib.c \ @@ -942,7 +939,8 @@ ALLPARAM = config/a29k/nm-ultra3.h config/a29k/tm-a29k.h \ config/m68k/nm-sun2.h \ config/m68k/nm-sun3.h config/m68k/tm-3b1.h config/m68k/tm-altos.h \ config/m68k/tm-apollo68b.h \ - config/m68k/tm-amix.h config/m68k/tm-delta68.h \ + config/m68k/tm-amix.h \ + config/m68k/tm-cisco.h config/m68k/tm-delta68.h \ config/m68k/tm-dpx2.h config/m68k/tm-es1800.h \ config/m68k/tm-hp300bsd.h config/m68k/tm-hp300hpux.h \ config/m68k/tm-isi.h config/m68k/tm-m68klynx.h \ @@ -971,11 +969,11 @@ ALLPARAM = config/a29k/nm-ultra3.h config/a29k/tm-a29k.h \ config/mips/tm-idt64.h config/mips/tm-idtl64.h \ config/mips/tm-irix3.h config/mips/tm-irix5.h \ config/mips/tm-mips.h config/mips/tm-mips64.h \ - config/mips/tm-mipsm3.h \ + config/mips/tm-mipsm3.h config/mips/tm-mipsv4.h \ config/mips/xm-irix3.h \ config/mips/xm-irix4.h config/mips/xm-irix5.h \ config/mips/xm-makeva.h config/mips/xm-mips.h \ - config/mips/xm-mipsm3.h \ + config/mips/xm-mipsm3.h config/mips/xm-mipsv4.h \ config/mips/xm-riscos.h config/mips/xm-news-mips.h \ config/nm-lynx.h config/nm-sysv4.h \ config/none/nm-none.h config/none/tm-none.h config/none/xm-none.h \ @@ -1026,7 +1024,8 @@ ALLCONFIG = config/a29k/a29k-kern.mt config/a29k/a29k-udi.mt \ config/m68k/3b1.mt config/m68k/altos.mh config/m68k/altos.mt \ config/m68k/amix.mh config/m68k/amix.mt config/m68k/apollo68b.mh \ config/m68k/apollo68b.mt \ - config/m68k/apollo68v.mh config/m68k/delta68.mh \ + config/m68k/apollo68v.mh \ + config/m68k/cisco.mt config/m68k/delta68.mh \ config/m68k/delta68.mt config/m68k/dpx2.mh config/m68k/dpx2.mt \ config/m68k/es1800.mt config/m68k/hp300bsd.mh \ config/m68k/hp300bsd.mt config/m68k/hp300hpux.mh \ @@ -1049,6 +1048,7 @@ ALLCONFIG = config/a29k/a29k-kern.mt config/a29k/a29k-udi.mt \ config/mips/littlemips.mh config/mips/littlemips.mt \ config/mips/mipsel64.mt \ config/mips/mipsm3.mh config/mips/mipsm3.mt \ + config/mips/mipsv4.mh config/mips/mipsv4.mt \ config/mips/news-mips.mh config/mips/riscos.mh \ config/none/none.mh config/none/none.mt config/ns32k/merlin.mh \ config/ns32k/merlin.mt config/ns32k/ns32km3.mh config/ns32k/ns32km3.mt \ @@ -1298,6 +1298,8 @@ mipsread.o: mipsread.c buildsym.h complaints.h $(bfd_h) $(defs_h) \ $(expression_h) gdb-stabs.h $(gdbcore_h) $(gdbtypes_h) language.h \ objfiles.h partial-stab.h stabsread.h symfile.h $(symtab_h) +mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h + news-xdep.o: news-xdep.c Onindy.o: nindy-share/Onindy.c $(wait_h) nindy-share/block_io.h \ diff --git a/gdb/annotate.c b/gdb/annotate.c new file mode 100644 index 0000000..73612aa --- /dev/null +++ b/gdb/annotate.c @@ -0,0 +1,508 @@ +/* Annotation routines for GDB. + Copyright 1986, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. + +This file is part of GDB. + +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 +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "defs.h" +#include "annotate.h" +#include "value.h" +#include "target.h" + +void +breakpoints_changed () +{ + if (annotation_level > 1) + { + target_terminal_ours (); + printf_unfiltered ("\n\032\032breakpoints-invalid\n"); + } +} + +void +annotate_breakpoint (num) + int num; +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032breakpoint %d\n", num); +} + +void +annotate_watchpoint (num) + int num; +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032watchpoint %d\n", num); +} + +void +annotate_starting () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032starting\n"); +} + +void +annotate_stopped () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032stopped\n"); +} + +void +annotate_exited (exitstatus) + int exitstatus; +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032exited %d\n", exitstatus); +} + +void +annotate_signalled () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032signalled\n"); +} + +void +annotate_signal_name () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032signal-name\n"); +} + +void +annotate_signal_name_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032signal-name-end\n"); +} + +void +annotate_signal_string () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032signal-string\n"); +} + +void +annotate_signal_string_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032signal-string-end\n"); +} + +void +annotate_signal () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032signal\n"); +} + +void +annotate_breakpoints_headers () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032breakpoints-headers\n"); +} + +void +annotate_field (num) + int num; +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032field %d\n", num); +} + +void +annotate_breakpoints_table () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032breakpoints-table\n"); +} + +void +annotate_record () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032record\n"); +} + +void +annotate_breakpoints_table_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032breakpoints-table-end\n"); +} + +void +annotate_frames_invalid () +{ + if (annotation_level > 1) + { + target_terminal_ours (); + printf_unfiltered ("\n\032\032frames-invalid\n"); + } +} + +void +annotate_field_begin (type) + struct type *type; +{ + if (annotation_level > 1) + { + printf_filtered ("\n\032\032field-begin "); + print_value_flags (type); + printf_filtered ("\n"); + } +} + +void +annotate_field_name_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032field-name-end\n"); +} + +void +annotate_field_value () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032field-value\n"); +} + +void +annotate_field_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032field-value\n"); +} + +void +annotate_quit () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032quit\n"); +} + +void +annotate_error () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032error\n"); +} + +void +annotate_error_begin () +{ + if (annotation_level > 1) + fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n"); +} + +void +annotate_value_history_begin (histindex, type) + int histindex; + struct type *type; +{ + if (annotation_level > 1) + { + printf_filtered ("\n\032\032value-history-begin %d ", histindex); + print_value_flags (type); + printf_filtered ("\n"); + } +} + +void +annotate_value_begin (type) + struct type *type; +{ + if (annotation_level > 1) + { + printf_filtered ("\n\032\032value-begin "); + print_value_flags (type); + printf_filtered ("\n"); + } +} + +void +annotate_value_history_value () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032value-history-value\n"); +} + +void +annotate_value_history_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032value-history-end\n"); +} + +void +annotate_value_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032value-end\n"); +} + +void +annotate_display_begin () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032display-begin\n"); +} + +void +annotate_display_number_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032display-number-end\n"); +} + +void +annotate_display_format () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032display-format\n"); +} + +void +annotate_display_expression () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032display-expression\n"); +} + +void +annotate_display_expression_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032display-expression-end\n"); +} + +void +annotate_display_value () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032display-value\n"); +} + +void +annotate_display_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032display-end\n"); +} + +void +annotate_arg_begin () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032arg-begin\n"); +} + +void +annotate_arg_name_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032arg-name-end\n"); +} + +void +annotate_arg_value (type) + struct type *type; +{ + if (annotation_level > 1) + { + printf_filtered ("\n\032\032arg-value "); + print_value_flags (type); + printf_filtered ("\n"); + } +} + +void +annotate_arg_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032arg-end\n"); +} + +void +annotate_source (filename, line, character, mid, pc) + char *filename; + int line; + int character; + int mid; + CORE_ADDR pc; +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032source "); + else + printf_filtered ("\032\032"); + + printf_filtered ("%s:%d:%d:%s:", filename, + line, character, + mid ? "middle" : "beg"); + print_address_numeric (pc, 0, gdb_stdout); + printf_filtered ("\n"); +} + +void +annotate_frame_begin (level, pc) + int level; + CORE_ADDR pc; +{ + if (annotation_level > 1) + { + printf_filtered ("\n\032\032frame-begin %d ", level); + print_address_numeric (pc, 0, gdb_stdout); + printf_filtered ("\n"); + } +} + +void +annotate_function_call () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032function-call\n"); +} + +void +annotate_signal_handler_caller () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032signal-handler-caller\n"); +} + +void +annotate_frame_address () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-address\n"); +} + +void +annotate_frame_address_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-address-end\n"); +} + +void +annotate_frame_function_name () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-function-name\n"); +} + +void +annotate_frame_args () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-args\n"); +} + +void +annotate_frame_source_begin () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-source-begin\n"); +} + +void +annotate_frame_source_file () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-source-file\n"); +} + +void +annotate_frame_source_file_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-source-file-end\n"); +} + +void +annotate_frame_source_line () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-source-line\n"); +} + +void +annotate_frame_source_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-source-end\n"); +} + +void +annotate_frame_where () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-where\n"); +} + +void +annotate_frame_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032frame-end\n"); +} + +void +annotate_array_section_begin (index, elttype) + int index; + struct type *elttype; +{ + if (annotation_level > 1) + { + printf_filtered ("\n\032\032array-section-begin %d ", index); + print_value_flags (elttype); + printf_filtered ("\n"); + } +} + +void +annotate_elt_rep (repcount) + unsigned int repcount; +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032elt-rep %u\n", repcount); +} + +void +annotate_elt_rep_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032elt-rep-end\n"); +} + +void +annotate_elt () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032elt\n"); +} + +void +annotate_array_section_end () +{ + if (annotation_level > 1) + printf_filtered ("\n\032\032array-section-end\n"); +} + diff --git a/gdb/annotate.h b/gdb/annotate.h new file mode 100644 index 0000000..0ec9765 --- /dev/null +++ b/gdb/annotate.h @@ -0,0 +1,95 @@ +/* Annotation routines for GDB. + Copyright 1986, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. + +This file is part of GDB. + +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 +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +extern void breakpoints_changed PARAMS ((void)); + +extern void annotate_breakpoint PARAMS ((int)); +extern void annotate_watchpoint PARAMS ((int)); +extern void annotate_starting PARAMS ((void)); +extern void annotate_stopped PARAMS ((void)); +extern void annotate_exited PARAMS ((int)); +extern void annotate_signalled PARAMS ((void)); +extern void annotate_signal_name PARAMS ((void)); +extern void annotate_signal_name_end PARAMS ((void)); +extern void annotate_signal_string PARAMS ((void)); +extern void annotate_signal_string_end PARAMS ((void)); +extern void annotate_signal PARAMS ((void)); + +extern void annotate_breakpoints_headers PARAMS ((void)); +extern void annotate_field PARAMS ((int)); +extern void annotate_breakpoints_table PARAMS ((void)); +extern void annotate_record PARAMS ((void)); +extern void annotate_breakpoints_table_end PARAMS ((void)); + +extern void annotate_frames_invalid PARAMS ((void)); + +#ifdef __STDC__ +struct type; +#endif + +extern void annotate_field_begin PARAMS ((struct type *)); +extern void annotate_field_name_end PARAMS ((void)); +extern void annotate_field_value PARAMS ((void)); +extern void annotate_field_end PARAMS ((void)); + +extern void annotate_quit PARAMS ((void)); +extern void annotate_error PARAMS ((void)); +extern void annotate_error_begin PARAMS ((void)); + +extern void annotate_value_history_begin PARAMS ((int, struct type *)); +extern void annotate_value_begin PARAMS ((struct type *)); +extern void annotate_value_history_value PARAMS ((void)); +extern void annotate_value_history_end PARAMS ((void)); +extern void annotate_value_end PARAMS ((void)); + +extern void annotate_display_begin PARAMS ((void)); +extern void annotate_display_number_end PARAMS ((void)); +extern void annotate_display_format PARAMS ((void)); +extern void annotate_display_expression PARAMS ((void)); +extern void annotate_display_expression_end PARAMS ((void)); +extern void annotate_display_value PARAMS ((void)); +extern void annotate_display_end PARAMS ((void)); + +extern void annotate_arg_begin PARAMS ((void)); +extern void annotate_arg_name_end PARAMS ((void)); +extern void annotate_arg_value PARAMS ((struct type *)); +extern void annotate_arg_end PARAMS ((void)); + +extern void annotate_source PARAMS ((char *, int, int, int, CORE_ADDR)); + +extern void annotate_frame_begin PARAMS ((int, CORE_ADDR)); +extern void annotate_function_call PARAMS ((void)); +extern void annotate_signal_handler_caller PARAMS ((void)); +extern void annotate_frame_address PARAMS ((void)); +extern void annotate_frame_address_end PARAMS ((void)); +extern void annotate_frame_function_name PARAMS ((void)); +extern void annotate_frame_args PARAMS ((void)); +extern void annotate_frame_source_begin PARAMS ((void)); +extern void annotate_frame_source_file PARAMS ((void)); +extern void annotate_frame_source_file_end PARAMS ((void)); +extern void annotate_frame_source_line PARAMS ((void)); +extern void annotate_frame_source_end PARAMS ((void)); +extern void annotate_frame_where PARAMS ((void)); +extern void annotate_frame_end PARAMS ((void)); + +extern void annotate_array_section_begin PARAMS ((int, struct type *)); +extern void annotate_elt_rep PARAMS ((unsigned int)); +extern void annotate_elt_rep_end PARAMS ((void)); +extern void annotate_elt PARAMS ((void)); +extern void annotate_array_section_end PARAMS ((void)); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 3e43ca3..a697560 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -35,6 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "language.h" #include <string.h> #include "demangle.h" +#include "annotate.h" /* local function prototypes */ @@ -193,19 +194,6 @@ int default_breakpoint_valid; CORE_ADDR default_breakpoint_address; struct symtab *default_breakpoint_symtab; int default_breakpoint_line; - -/* Flag indicating extra verbosity for xgdb. */ -extern int xgdb_verbose; - -static void -breakpoints_changed () -{ - if (annotation_level > 1) - { - target_terminal_ours (); - printf_unfiltered ("\n\032\032breakpoints-invalid\n"); - } -} /* *PP is a string denoting a breakpoint. Get the number of the breakpoint. Advance *PP after the string and any trailing whitespace. @@ -945,12 +933,14 @@ print_it_normal (bs) { /* I think the user probably only wants to see one breakpoint number, not all of them. */ + annotate_breakpoint (bs->breakpoint_at->number); printf_filtered ("\nBreakpoint %d, ", bs->breakpoint_at->number); return 0; } - + if (bs->old_val != NULL) { + annotate_watchpoint (bs->breakpoint_at->number); printf_filtered ("\nWatchpoint %d, ", bs->breakpoint_at->number); print_expression (bs->breakpoint_at->exp, gdb_stdout); printf_filtered ("\nOld value = "); @@ -1044,7 +1034,6 @@ watchpoint_check (p) char *p; { bpstat bs = (bpstat) p; - struct breakpoint *b; FRAME saved_frame, fr; int within_current_scope, saved_level; @@ -1540,46 +1529,33 @@ breakpoint_1 (bnum, allflag) if (!found_a_breakpoint++) { - if (annotation_level > 1) - printf_filtered ("\n\032\032breakpoints-headers\n"); - - if (annotation_level > 1) - printf_filtered ("\n\032\032field 0\n"); + annotate_field (0); printf_filtered ("Num "); - if (annotation_level > 1) - printf_filtered ("\n\032\032field 1\n"); + annotate_field (1); printf_filtered ("Type "); - if (annotation_level > 1) - printf_filtered ("\n\032\032field 2\n"); + annotate_field (2); printf_filtered ("Disp "); - if (annotation_level > 1) - printf_filtered ("\n\032\032field 3\n"); + annotate_field (3); printf_filtered ("Enb "); if (addressprint) { - if (annotation_level > 1) - printf_filtered ("\n\032\032field 4\n"); + annotate_field (4); printf_filtered ("Address "); } - if (annotation_level > 1) - printf_filtered ("\n\032\032field 5\n"); + annotate_field (5); printf_filtered ("What\n"); - if (annotation_level > 1) - printf_filtered ("\n\032\032breakpoints-table\n"); + annotate_breakpoints_table (); } - if (annotation_level > 1) - printf_filtered ("\n\032\032record\n\n\032\032field 0\n"); + annotate_record (); + annotate_field (0); printf_filtered ("%-3d ", b->number); - if (annotation_level > 1) - printf_filtered ("\n\032\032field 1\n"); + annotate_field (1); printf_filtered ("%-14s ", bptypes[(int)b->type]); - if (annotation_level > 1) - printf_filtered ("\n\032\032field 2\n"); + annotate_field (2); printf_filtered ("%-4s ", bpdisps[(int)b->disposition]); - if (annotation_level > 1) - printf_filtered ("\n\032\032field 3\n"); + annotate_field (3); printf_filtered ("%-3c ", bpenables[(int)b->enable]); strcpy (wrap_indent, " "); @@ -1592,8 +1568,7 @@ breakpoint_1 (bnum, allflag) /* Field 4, the address, is omitted (which makes the columns not line up too nicely with the headers, but the effect is relatively readable). */ - if (annotation_level > 1) - printf_filtered ("\n\032\032field 5\n"); + annotate_field (5); print_expression (b->exp, gdb_stdout); break; @@ -1608,8 +1583,7 @@ breakpoint_1 (bnum, allflag) case bp_call_dummy: if (addressprint) { - if (annotation_level > 1) - printf_filtered ("\n\032\032field 4\n"); + annotate_field (4); /* FIXME-32x64: need a print_address_numeric with field width */ printf_filtered @@ -1618,8 +1592,7 @@ breakpoint_1 (bnum, allflag) ((unsigned long) b->address, "08l")); } - if (annotation_level > 1) - printf_filtered ("\n\032\032field 5\n"); + annotate_field (5); last_addr = b->address; if (b->source_file) @@ -1644,8 +1617,7 @@ breakpoint_1 (bnum, allflag) if (b->frame) { - if (annotation_level > 1) - printf_filtered ("\n\032\032field 6\n"); + annotate_field (6); printf_filtered ("\tstop only in stack frame at "); print_address_numeric (b->frame, 1, gdb_stdout); @@ -1654,8 +1626,7 @@ breakpoint_1 (bnum, allflag) if (b->cond) { - if (annotation_level > 1) - printf_filtered ("\n\032\032field 7\n"); + annotate_field (7); printf_filtered ("\tstop only if "); print_expression (b->cond, gdb_stdout); @@ -1664,16 +1635,14 @@ breakpoint_1 (bnum, allflag) if (b->ignore_count) { - if (annotation_level > 1) - printf_filtered ("\n\032\032field 8\n"); + annotate_field (8); printf_filtered ("\tignore next %d hits\n", b->ignore_count); } if ((l = b->commands)) { - if (annotation_level > 1) - printf_filtered ("\n\032\032field 9\n"); + annotate_field (9); while (l) { @@ -1698,8 +1667,7 @@ breakpoint_1 (bnum, allflag) if (last_addr != (CORE_ADDR)-1) set_next_address (last_addr); - if (annotation_level > 1) - printf_filtered ("\n\032\032breakpoints-table-end\n"); + annotate_breakpoints_table_end (); } /* ARGSUSED */ diff --git a/gdb/c-exp.y b/gdb/c-exp.y index c3befb7..399b2aa 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1056,7 +1056,8 @@ parse_number (p, len, parsed_float, putithere) << 16); if (high_bit == 0) /* A long long does not fit in a LONGEST. */ - high_bit = (unsigned LONGEST)1 << sizeof (LONGEST) * HOST_CHAR_BIT - 1; + high_bit = + (unsigned LONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1); unsigned_type = builtin_type_unsigned_long_long; signed_type = builtin_type_long_long; } diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c index 740af37..9bc4303 100644 --- a/gdb/ch-typeprint.c +++ b/gdb/ch-typeprint.c @@ -74,7 +74,6 @@ chill_type_print_base (type, stream, show, level) int show; int level; { - char *name; register int len; register int i; struct type *index_type; diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c index 68ea1a7..422baa4 100644 --- a/gdb/ch-valprint.c +++ b/gdb/ch-valprint.c @@ -28,6 +28,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "language.h" #include "demangle.h" #include "c-lang.h" /* For c_val_print */ +#include "typeprint.h" +#include "ch-lang.h" static void chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int, @@ -201,7 +203,6 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, int i; int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING; int need_comma = 0; - int in_range = 0; if (is_bitstring) fputs_filtered ("B'", stream); @@ -253,10 +254,11 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, fprintf_filtered (stream, "<dynamic length %d > static length %d>", length, TYPE_LENGTH (type)); - length > TYPE_LENGTH (type); } LA_PRINT_STRING (stream, data_addr, length, 0); return length; + default: + break; } } chill_print_value_fields (type, valaddr, stream, format, recurse, pretty, diff --git a/gdb/coffread.c b/gdb/coffread.c index 0797a93..ff74f47 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -143,8 +143,6 @@ static struct symbol *opaque_type_chain[HASHSIZE]; struct type *in_function_type; #endif -struct pending_block *pending_blocks; - /* Complaints about various problems in the file being read */ struct complaint ef_complaint = @@ -900,29 +898,32 @@ read_coff_symtab (symtab_offset, nsyms, objfile) break; /* fall in for static symbols that don't start with '.' */ case C_EXT: - /* Record external symbols in minsyms if we don't have debug - info for them. FIXME, this is probably the wrong thing - to do. Why don't we record them even if we do have - debug symbol info? What really belongs in the minsyms - anyway? Fred!?? */ - if (!SDB_TYPE (cs->c_type)) { - /* FIXME: This is BOGUS Will Robinson! - Coff should provide the SEC_CODE flag for executable sections, - then if we could look up sections by section number we - could see if the flags indicate SEC_CODE. If so, then - record this symbol as a function in the minimal symbol table. - But why are absolute syms recorded as functions, anyway? */ - if (cs->c_secnum <= text_bfd_scnum+1) {/* text or abs */ - record_minimal_symbol (cs->c_name, cs->c_value, - mst_text, objfile); - break; - } else { - record_minimal_symbol (cs->c_name, cs->c_value, - mst_data, objfile); - break; - } - } - process_coff_symbol (cs, &main_aux, objfile); + /* Record it in the minimal symbols regardless of SDB_TYPE. + This parallels what we do for other debug formats, and + probably is needed to make print_address_symbolic work right + without the "set fast-symbolic-addr off" kludge. */ + + /* FIXME: This bogusly assumes the sections are in a certain + order, text (SEC_CODE) sections are before data sections, + etc. */ + if (cs->c_secnum <= text_bfd_scnum+1) + { + /* text or absolute. (FIXME, should use mst_abs if + absolute). */ + record_minimal_symbol + (cs->c_name, cs->c_value, + cs->c_sclass == C_STAT ? mst_file_text : mst_text, + objfile); + } + else + { + record_minimal_symbol + (cs->c_name, cs->c_value, + cs->c_sclass == C_STAT ? mst_file_data : mst_data, + objfile); + } + if (SDB_TYPE (cs->c_type)) + process_coff_symbol (cs, &main_aux, objfile); break; case C_FCN: @@ -1412,7 +1413,6 @@ process_coff_symbol (cs, aux, objfile) = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); char *name; - struct type *temptype; memset (sym, 0, sizeof (struct symbol)); name = cs->c_name; @@ -1502,16 +1502,19 @@ process_coff_symbol (cs, aux, objfile) #endif add_symbol_to_list (sym, &local_symbols); #if !defined (BELIEVE_PCC_PROMOTION) && (TARGET_BYTE_ORDER == BIG_ENDIAN) - /* If PCC says a parameter is a short or a char, - aligned on an int boundary, realign it to the "little end" - of the int. */ - temptype = lookup_fundamental_type (current_objfile, FT_INTEGER); - if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype) - && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT - && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (temptype)) + { + /* If PCC says a parameter is a short or a char, + aligned on an int boundary, realign it to the "little end" + of the int. */ + struct type *temptype; + temptype = lookup_fundamental_type (current_objfile, FT_INTEGER); + if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype) + && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT + && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (temptype)) { - SYMBOL_VALUE (sym) += TYPE_LENGTH (temptype) - - TYPE_LENGTH (SYMBOL_TYPE (sym)); + SYMBOL_VALUE (sym) += + TYPE_LENGTH (temptype) + - TYPE_LENGTH (SYMBOL_TYPE (sym)); } #endif break; @@ -1523,17 +1526,21 @@ process_coff_symbol (cs, aux, objfile) #if !defined (BELIEVE_PCC_PROMOTION) /* FIXME: This should retain the current type, since it's just a register value. gnu@adobe, 26Feb93 */ - /* If PCC says a parameter is a short or a char, - it is really an int. */ - temptype = lookup_fundamental_type (current_objfile, FT_INTEGER); - if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype) - && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT) - { - SYMBOL_TYPE (sym) = TYPE_UNSIGNED (SYMBOL_TYPE (sym)) - ? lookup_fundamental_type (current_objfile, - FT_UNSIGNED_INTEGER) - : temptype; - } + { + /* If PCC says a parameter is a short or a char, + it is really an int. */ + struct type *temptype; + temptype = + lookup_fundamental_type (current_objfile, FT_INTEGER); + if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype) + && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT) + { + SYMBOL_TYPE (sym) = + (TYPE_UNSIGNED (SYMBOL_TYPE (sym)) + ? lookup_fundamental_type (current_objfile, + FT_UNSIGNED_INTEGER) + : temptype); + } #endif break; @@ -1543,7 +1550,34 @@ process_coff_symbol (cs, aux, objfile) /* If type has no name, give it one */ if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) - TYPE_NAME (SYMBOL_TYPE (sym)) = concat (SYMBOL_NAME (sym), NULL); + { + if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR + || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC) + { + /* If we are giving a name to a type such as "pointer to + foo" or "function returning foo", we better not set + the TYPE_NAME. If the program contains "typedef char + *caddr_t;", we don't want all variables of type char + * to print as caddr_t. This is not just a + consequence of GDB's type management; CC and GCC (at + least through version 2.4) both output variables of + either type char * or caddr_t with the type + refering to the C_TPDEF symbol for caddr_t. If a future + compiler cleans this up it GDB is not ready for it + yet, but if it becomes ready we somehow need to + disable this check (without breaking the PCC/GCC2.4 + case). + + Sigh. + + Fortunately, this check seems not to be necessary + for anything except pointers or functions. */ + ; + } + else + TYPE_NAME (SYMBOL_TYPE (sym)) = + concat (SYMBOL_NAME (sym), NULL); + } /* Keep track of any type which points to empty structured type, so it can be filled from a definition from another file. A @@ -2017,16 +2051,6 @@ coff_read_enum_type (index, length, lastsym) break; } -#if 0 - /* This screws up perfectly good C programs with enums. FIXME. */ - /* Is this Modula-2's BOOLEAN type? Flag it as such if so. */ - if(TYPE_NFIELDS(type) == 2 && - ((STREQ(TYPE_FIELD_NAME(type,0),"TRUE") && - STREQ(TYPE_FIELD_NAME(type,1),"FALSE")) || - (STREQ(TYPE_FIELD_NAME(type,1),"TRUE") && - STREQ(TYPE_FIELD_NAME(type,0),"FALSE")))) - TYPE_CODE(type) = TYPE_CODE_BOOL; -#endif return type; } diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 0a4c841..af8d767 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "command.h" #include "gdbcmd.h" #include "demangle.h" +#include "annotate.h" int vtblprint; /* Controls printing of vtbl's */ int objectprint; /* Controls looking up an object's derived type @@ -283,21 +284,14 @@ cp_print_value_fields (type, valaddr, stream, format, recurse, pretty, } else { - if (annotation_level > 1) - { - printf_filtered ("\n\032\032field-begin "); - print_value_flags (TYPE_FIELD_TYPE (type, i)); - printf_filtered ("\n"); - } + annotate_field_begin (TYPE_FIELD_TYPE (type, i)); fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), language_cplus, DMGL_PARAMS | DMGL_ANSI); - if (annotation_level > 1) - printf_filtered ("\n\032\032field-name-end\n"); + annotate_field_name_end (); fputs_filtered (" = ", stream); - if (annotation_level > 1) - printf_filtered ("\n\032\032field-value\n"); + annotate_field_value (); } if (TYPE_FIELD_PACKED (type, i)) @@ -332,8 +326,7 @@ cp_print_value_fields (type, valaddr, stream, format, recurse, pretty, 0, stream, format, 0, recurse + 1, pretty); } } - if (annotation_level > 1) - printf_filtered ("\n\032\032field-end\n"); + annotate_field_end (); } if (pretty) diff --git a/gdb/infrun.c b/gdb/infrun.c index dfe2cc0..4c39237 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -30,6 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "gdbcmd.h" #include "target.h" #include "thread.h" +#include "annotate.h" #include <signal.h> @@ -326,6 +327,8 @@ The same program may be running in another process."); else if (!signal_program[stop_signal]) stop_signal = TARGET_SIGNAL_0; + annotate_starting (); + /* Resume inferior. */ resume (oneproc || step || bpstat_should_step (), stop_signal); @@ -434,12 +437,12 @@ wait_for_inferior () while (1) { + pid = target_wait (-1, &w); + /* Clean up saved state that will become invalid. */ flush_cached_frames (); registers_changed (); - pid = target_wait (-1, &w); - switch (w.kind) { case TARGET_WAITKIND_LOADED: @@ -458,6 +461,7 @@ wait_for_inferior () case TARGET_WAITKIND_EXITED: target_terminal_ours (); /* Must do this before mourn anyway */ + annotate_exited (w.value.integer); if (w.value.integer) printf_filtered ("\nProgram exited with code 0%o.\n", (unsigned int)w.value.integer); @@ -476,10 +480,17 @@ wait_for_inferior () stop_print_frame = 0; stop_signal = w.value.sig; target_terminal_ours (); /* Must do this before mourn anyway */ + annotate_signalled (); target_kill (); /* kill mourns as well */ - printf_filtered ("\nProgram terminated with signal %s, %s.\n", - target_signal_to_name (stop_signal), - target_signal_to_string (stop_signal)); + printf_filtered ("\nProgram terminated with signal "); + annotate_signal_name (); + printf_filtered ("%s", target_signal_to_name (stop_signal)); + annotate_signal_name_end (); + printf_filtered (", "); + annotate_signal_string (); + printf_filtered ("%s", target_signal_to_string (stop_signal)); + annotate_signal_string_end (); + printf_filtered (".\n"); printf_filtered ("The program no longer exists.\n"); gdb_flush (gdb_stdout); @@ -561,8 +572,6 @@ wait_for_inferior () { if (signal_print[stop_signal]) { - char *signame; - printed = 1; target_terminal_ours_for_output (); printf_filtered ("\nProgram received signal %s, %s.\n", @@ -657,7 +666,16 @@ switch_thread: { remove_breakpoints (); resume (1, 0); + + /* FIXME: This is bogus. You can't interact with the + inferior except when it is stopped. It apparently + happens to work on Irix4, but it depends on /proc + allowing us to muck with the memory of a running process, + and the kernel deciding to run one instruction of the + inferior before it executes our insert_breakpoints code, + which seems like an awfully dubious assumption. */ insert_breakpoints (); + continue; } #endif @@ -781,12 +799,18 @@ switch_thread: if (signal_print[stop_signal]) { - char *signame; printed = 1; target_terminal_ours_for_output (); - printf_filtered ("\nProgram received signal %s, %s.\n", - target_signal_to_name (stop_signal), - target_signal_to_string (stop_signal)); + annotate_signal (); + printf_filtered ("\nProgram received signal "); + annotate_signal_name (); + printf_filtered ("%s", target_signal_to_name (stop_signal)); + annotate_signal_name_end (); + printf_filtered (", "); + annotate_signal_string (); + printf_filtered ("%s", target_signal_to_string (stop_signal)); + annotate_signal_string_end (); + printf_filtered (".\n"); gdb_flush (gdb_stdout); } if (signal_stop[stop_signal]) @@ -1410,7 +1434,7 @@ Further execution is probably impossible.\n"); disable_current_display (); if (step_multi && stop_step) - return; + goto done; target_terminal_ours (); @@ -1423,7 +1447,7 @@ Further execution is probably impossible.\n"); } if (!target_has_stack) - return; + goto done; /* Select innermost stack frame except on return from a stack dummy routine, or if the program has exited. Print it without a level number if @@ -1465,6 +1489,8 @@ Further execution is probably impossible.\n"); stop_pc = read_pc(); select_frame (get_current_frame (), 0); } + done: + annotate_stopped (); } static int @@ -30,6 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "expression.h" #include "language.h" #include "terminal.h" /* For job_control. */ +#include "annotate.h" #include "getopt.h" @@ -387,10 +388,10 @@ return_to_top_level (reason) switch (reason) { case RETURN_QUIT: - printf_unfiltered ("\n\032\032quit\n"); + annotate_quit (); break; case RETURN_ERROR: - printf_unfiltered ("\n\032\032error\n"); + annotate_error (); break; } diff --git a/gdb/os9kread.c b/gdb/os9kread.c index f1d7912..cf728fe 100644 --- a/gdb/os9kread.c +++ b/gdb/os9kread.c @@ -105,9 +105,6 @@ extern int info_verbose; extern int previous_stab_code; -/* The BFD for this file -- implicit parameter to next_symbol_text. */ -static bfd *symfile_bfd; - /* Name of last function encountered. Used in Solaris to approximate object file boundaries. */ static char *last_function_name; @@ -125,12 +122,13 @@ extern struct complaint repeated_header_complaint; extern struct complaint repeated_header_name_complaint; +#if 0 static struct complaint lbrac_unmatched_complaint = {"unmatched Increment Block Entry before symtab pos %d", 0, 0}; static struct complaint lbrac_mismatch_complaint = {"IBE/IDE symbol mismatch at symtab pos %d", 0, 0}; - +#endif /* Local function prototypes */ static void @@ -149,9 +147,6 @@ read_os9k_psymtab PARAMS ((struct section_offsets *, struct objfile *, static void init_psymbol_list PARAMS ((struct objfile *)); -static char * -os9k_next_symbol_text PARAMS ((void)); - static int fill_sym PARAMS ((FILE *, bfd *)); @@ -265,7 +260,7 @@ struct stbsymbol { }; #define STBSYMSIZE 10 -static int +static void read_minimal_symbols(objfile, section_offsets) struct objfile *objfile; struct section_offsets *section_offsets; @@ -320,7 +315,7 @@ char buf[64], buf1[128]; off += STBSYMSIZE; }; install_minimal_symbols (objfile); - return 1; + return; } /* Scan and build partial symbols for a symbol file. @@ -340,8 +335,6 @@ os9k_symfile_read (objfile, section_offsets, mainline) int mainline; /* FIXME comments above */ { bfd *sym_bfd; - int val; - int stb_exist; struct cleanup *back_to; sym_bfd = objfile->obfd; @@ -401,7 +394,6 @@ static void os9k_symfile_init (objfile) struct objfile *objfile; { - int val; bfd *sym_bfd = objfile->obfd; char *name = bfd_get_filename (sym_bfd); char dbgname[512], stbname[512]; @@ -502,7 +494,6 @@ fill_sym (dbg_file, abfd) FILE *dbg_file; bfd *abfd; { -short id; short si, nmask; long li; int ii; @@ -606,10 +597,11 @@ read_os9k_psymtab (section_offsets, objfile, text_addr, text_size) { register struct internal_symstruct *bufp = 0; /* =0 avoids gcc -Wall glitch*/ register char *namestring; - int nsl; int past_first_source_file = 0; CORE_ADDR last_o_file_start = 0; +#if 0 struct cleanup *back_to; +#endif bfd *abfd; FILE *fp; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 25c2745..d693a3e 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -33,6 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "breakpoint.h" #include "demangle.h" #include "valprint.h" +#include "annotate.h" extern int asm_demangle; /* Whether to demangle syms in asm printouts */ extern int addressprint; /* Whether to print hex addresses in HLL " */ @@ -826,34 +827,26 @@ print_command_1 (exp, inspect, voidprint) { int histindex = record_latest_value (val); - if (annotation_level > 1) - { - if (histindex >= 0) - printf_filtered ("\n\032\032value-history-begin %d ", histindex); - else - printf_filtered ("\n\032\032value-begin "); - print_value_flags (VALUE_TYPE (val)); - printf_filtered ("\n"); - } + if (histindex >= 0) + annotate_value_history_begin (histindex, VALUE_TYPE (val)); + else + annotate_value_begin (VALUE_TYPE (val)); if (inspect) printf_unfiltered ("\031(gdb-makebuffer \"%s\" %d '(\"", exp, histindex); else if (histindex >= 0) printf_filtered ("$%d = ", histindex); - if (annotation_level > 1 && histindex >= 0) - printf_filtered ("\n\032\032value-history-value\n"); + if (histindex >= 0) + annotate_value_history_value (); print_formatted (val, format, fmt.size); printf_filtered ("\n"); - if (annotation_level > 1) - { - if (histindex >= 0) - printf_filtered ("\n\032\032value-history-end\n"); - else - printf_filtered ("\n\032\032value-end\n"); - } + if (histindex >= 0) + annotate_value_history_end (); + else + annotate_value_end (); if (inspect) printf_unfiltered("\") )\030"); @@ -920,17 +913,11 @@ output_command (exp, from_tty) val = evaluate_expression (expr); - if (annotation_level > 1) - { - printf_filtered ("\n\032\032value-begin "); - print_value_flags (VALUE_TYPE (val)); - printf_filtered ("\n"); - } + annotate_value_begin (VALUE_TYPE (val)); print_formatted (val, format, fmt.size); - if (annotation_level > 1) - printf_filtered ("\n\032\032value-end\n"); + annotate_value_end (); do_cleanups (old_chain); } @@ -1313,11 +1300,16 @@ do_one_display (d) current_display_number = d->number; - printf_filtered ("%d: ", d->number); + annotate_display_begin (); + printf_filtered ("%d", d->number); + annotate_display_number_end (); + printf_filtered (": "); if (d->format.size) { CORE_ADDR addr; - + + annotate_display_format (); + printf_filtered ("x/"); if (d->format.count != 1) printf_filtered ("%d", d->format.count); @@ -1325,7 +1317,12 @@ do_one_display (d) if (d->format.format != 'i' && d->format.format != 's') printf_filtered ("%c", d->format.size); printf_filtered (" "); + + annotate_display_expression (); + print_expression (d->exp, gdb_stdout); + annotate_display_expression_end (); + if (d->format.count != 1) printf_filtered ("\n"); else @@ -1334,20 +1331,34 @@ do_one_display (d) addr = value_as_pointer (evaluate_expression (d->exp)); if (d->format.format == 'i') addr = ADDR_BITS_REMOVE (addr); - + + annotate_display_value (); + do_examine (d->format, addr); } else { + annotate_display_format (); + if (d->format.format) printf_filtered ("/%c ", d->format.format); + + annotate_display_expression (); + print_expression (d->exp, gdb_stdout); + annotate_display_expression_end (); + printf_filtered (" = "); + + annotate_display_expression (); + print_formatted (evaluate_expression (d->exp), d->format.format, d->format.size); printf_filtered ("\n"); } + annotate_display_end (); + gdb_flush (gdb_stdout); current_display_number = -1; } @@ -1646,13 +1657,11 @@ print_frame_args (func, fi, num, stream) fprintf_filtered (stream, ", "); wrap_here (" "); - if (annotation_level > 1) - printf_filtered ("\n\032\032arg-begin\n"); + annotate_arg_begin (); fprintf_symbol_filtered (stream, SYMBOL_SOURCE_NAME (sym), SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI); - if (annotation_level > 1) - printf_filtered ("\n\032\032arg-name-end\n"); + annotate_arg_name_end (); fputs_filtered ("=", stream); /* Avoid value_print because it will deref ref parameters. We just @@ -1662,12 +1671,7 @@ print_frame_args (func, fi, num, stream) 2 for each recurse. */ val = read_var_value (sym, FRAME_INFO_ID (fi)); - if (annotation_level > 1) - { - printf_filtered ("\n\032\032arg-value "); - print_value_flags (val == NULL ? NULL : VALUE_TYPE (val)); - printf_filtered ("\n"); - } + annotate_arg_value (val == NULL ? NULL : VALUE_TYPE (val)); if (val) val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), VALUE_ADDRESS (val), @@ -1675,8 +1679,7 @@ print_frame_args (func, fi, num, stream) else fputs_filtered ("???", stream); - if (annotation_level > 1) - printf_filtered ("\n\032\032arg-end\n"); + annotate_arg_end (); first = 0; } diff --git a/gdb/remote.c b/gdb/remote.c index 6da0f21..40536ef 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -280,15 +280,18 @@ remote_close (quitting) static void get_offsets () { - unsigned char buf [PBUFSIZ]; + unsigned char buf[PBUFSIZ]; int nvals; CORE_ADDR text_addr, data_addr, bss_addr; struct section_offsets *offs; putpkt ("qOffsets"); - getpkt (buf, 1); + getpkt (buf, 0); + if (buf[0] == '\000') + return; /* Return silently. Stub doesn't support this + command. */ if (buf[0] == 'E') { warning ("Remote failure reply: %s", buf); @@ -471,7 +474,6 @@ remote_resume (pid, step, siggnal) if (siggnal) { - char *name; target_terminal_ours_for_output (); printf_filtered ("Can't send signals to a remote system. %s not sent.\n", diff --git a/gdb/source.c b/gdb/source.c index ec56937..50eb127 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -34,6 +34,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "regex.h" #include "symfile.h" #include "objfiles.h" +#include "annotate.h" #ifndef DIRNAME_SEPARATOR #define DIRNAME_SEPARATOR ':' @@ -813,12 +814,9 @@ 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; - /* FIXME-32x64: Need a version of print_address_numeric which does - not pass use_local to print_longest. */ - printf_unfiltered ("\032\032%s:%d:%d:%s:0x%lx\n", s->fullname, - line, s->line_charpos[line - 1], - mid_statement ? "middle" : "beg", - (unsigned long) pc); + annotate_source (s->fullname, line, s->line_charpos[line - 1], + mid_statement, pc); + current_source_line = line; first_line_listed = line; last_line_listed = line; @@ -1042,14 +1040,14 @@ list_command (arg, from_tty) sym = find_pc_function (sal.pc); if (sym) { - print_address_numeric (sal.pc, gdb_stdout); + print_address_numeric (sal.pc, 1, gdb_stdout); printf_filtered (" is in "); fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout); printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line); } else { - print_address_numeric (sal.pc, gdb_stdout); + print_address_numeric (sal.pc, 1, gdb_stdout); printf_filtered (" is at %s:%d.\n", sal.symtab->filename, sal.line); } @@ -1172,7 +1170,7 @@ line_info (arg, from_tty) /* If this is the only line, show the source code. If it could not find the file, don't do anything special. */ - if (frame_file_full_name && sals.nelts == 1) + if (annotation_level && sals.nelts == 1) identify_source_line (sal.symtab, sal.line, 0, start_pc); } else diff --git a/gdb/stabsread.h b/gdb/stabsread.h index cf64424..cc1e24b 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -198,6 +198,13 @@ extern void coffstab_build_psymtabs file_ptr stabstroffset, unsigned int stabstrsize)); +extern void stabsect_build_psymtabs + PARAMS ((struct objfile *objfile, + struct section_offsets *section_offsets, + int mainline, + char *stab_name, + char *stabstr_name)); + extern void elfstab_offset_sections PARAMS ((struct objfile *, struct partial_symtab *)); diff --git a/gdb/symtab.c b/gdb/symtab.c index dfe5ac8..0a63964 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -111,8 +111,8 @@ void cplusplus_hint (name) char *name; { - printf_unfiltered ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name, name); - printf_unfiltered ("(Note leading single quote.)\n"); + printf_filtered ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name, name); + printf_filtered ("(Note leading single quote.)\n"); } /* Check for a symtab of a specific name; first in symtabs, then in @@ -188,7 +188,9 @@ lookup_symtab (name) char *name; { register struct symtab *s; +#if 0 register char *copy; +#endif s = lookup_symtab_1 (name); if (s) return s; @@ -1811,7 +1813,10 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) struct symtab_and_line val; #endif register char *p, *p1; - char *q, *q1, *pp; + char *q, *pp; +#if 0 + char *q1; +#endif register struct symtab *s; register struct symbol *sym; @@ -1927,7 +1932,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) if (opname == NULL) { error_begin (); - printf_unfiltered ("no mangling for \"%s\"\n", tmp); + printf_filtered ("no mangling for \"%s\"\n", tmp); cplusplus_hint (saved_arg); return_to_top_level (RETURN_ERROR); } @@ -2021,11 +2026,11 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) tmp = copy; error_begin (); if (tmp[0] == '~') - printf_unfiltered + printf_filtered ("the class `%s' does not have destructor defined\n", SYMBOL_SOURCE_NAME(sym_class)); else - printf_unfiltered + printf_filtered ("the class %s does not have any method named %s\n", SYMBOL_SOURCE_NAME(sym_class), tmp); cplusplus_hint (saved_arg); @@ -2036,7 +2041,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) { error_begin (); /* The quotes are important if copy is empty. */ - printf_unfiltered + printf_filtered ("can't find class, struct, or union named \"%s\"\n", copy); cplusplus_hint (saved_arg); return_to_top_level (RETURN_ERROR); diff --git a/gdb/target.h b/gdb/target.h index 1e9ea2a..42c3575 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -99,6 +99,7 @@ enum target_signal { /* Used some places (e.g. stop_signal) to record the concept that there is no signal. */ TARGET_SIGNAL_0 = 0, + TARGET_SIGNAL_FIRST = 0, TARGET_SIGNAL_HUP = 1, TARGET_SIGNAL_INT = 2, TARGET_SIGNAL_QUIT = 3, @@ -532,6 +533,8 @@ print_section_info PARAMS ((struct target_ops *, bfd *)); #define target_has_execution \ (current_target->to_has_execution) +extern void target_link PARAMS ((char *, CORE_ADDR *)); + /* Converts a process id to a string. Usually, the string just contains `process xyz', but on some systems it may contain `process xyz thread abc'. */ @@ -580,10 +583,7 @@ struct section_table { CORE_ADDR addr; /* Lowest address in section */ CORE_ADDR endaddr; /* 1+highest address in section */ - /* For the ptx compiler, we can't use the sec_ptr typedef when the field's - name is sec_ptr. We really should rename the field (or better yet, - the typedef should be bfd_sec_ptr). */ - struct sec *sec_ptr; /* BFD section pointer */ + sec_ptr the_bfd_section; bfd *bfd; /* BFD file pointer */ }; diff --git a/gdb/utils.c b/gdb/utils.c index 0640cac..4474b83 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -36,6 +36,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "demangle.h" #include "expression.h" #include "language.h" +#include "annotate.h" #include "readline.h" @@ -262,8 +263,7 @@ error_begin () wrap_here (""); /* Force out any buffered output */ gdb_flush (gdb_stdout); - if (annotation_level > 1) - fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n"); + annotate_error_begin (); if (error_pre_print) fprintf_filtered (gdb_stderr, error_pre_print); @@ -453,8 +453,7 @@ quit () SERIAL_FLUSH_OUTPUT (gdb_stdout_serial); SERIAL_UN_FDOPEN (gdb_stdout_serial); - if (annotation_level > 1) - fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n"); + annotate_error_begin (); /* Don't use *_filtered; we don't want to prompt the user to continue. */ if (error_pre_print) diff --git a/gdb/valprint.c b/gdb/valprint.c index 55db346..d4c8696 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "obstack.h" #include "language.h" #include "demangle.h" +#include "annotate.h" #include <errno.h> @@ -314,8 +315,10 @@ val_print_type_code_int (type, valaddr, stream) printf() that supports "ll" in the format string. We handle these by seeing if the number is actually a long, and if not we just bail out and print the number in hex. The format chars b,h,w,g are from - print_scalar_formatted(). USE_LOCAL says whether or not to call the - local formatting routine to get the format. */ + print_scalar_formatted(). If USE_LOCAL, format it according to the current + language (this should be used for most integers which GDB prints, the + exception is things like protocols where the format of the integer is + a protocol thing, not a user-visible thing). */ void print_longest (stream, format, use_local, val_long) @@ -600,7 +603,9 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref, elttype = TYPE_TARGET_TYPE (type); eltlen = TYPE_LENGTH (elttype); len = TYPE_LENGTH (type) / eltlen; - + + annotate_array_section_begin (i, elttype); + for (; i < len && things_printed < print_max; i++) { if (i != 0) @@ -616,7 +621,7 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref, } } wrap_here (n_spaces (2 + 2 * recurse)); - + rep1 = i + 1; reps = 1; while ((rep1 < len) && @@ -626,18 +631,14 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref, ++rep1; } - if (annotation_level > 1) - { - printf_filtered ("\n\032\032array-element-begin %d ", i); - print_value_flags (elttype); - printf_filtered ("\n"); - } - if (reps > repeat_count_threshold) { val_print (elttype, valaddr + i * eltlen, 0, stream, format, deref_ref, recurse + 1, pretty); + annotate_elt_rep (reps); fprintf_filtered (stream, " <repeats %u times>", reps); + annotate_elt_rep_end (); + i = rep1 - 1; things_printed += repeat_count_threshold; } @@ -645,11 +646,11 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref, { val_print (elttype, valaddr + i * eltlen, 0, stream, format, deref_ref, recurse + 1, pretty); + annotate_elt (); things_printed++; } - if (annotation_level > 1) - printf_filtered ("\n\032\032array-element-end\n"); } + annotate_array_section_end (); if (i < len) { fprintf_filtered (stream, "..."); @@ -862,13 +863,13 @@ val_print_string (addr, len, stream) if (errcode == EIO) { fprintf_filtered (stream, " <Address "); - print_address_numeric (addr, stream); + print_address_numeric (addr, 1, stream); fprintf_filtered (stream, " out of bounds>"); } else { fprintf_filtered (stream, " <Error reading address "); - print_address_numeric (addr, stream); + print_address_numeric (addr, 1, stream); fprintf_filtered (stream, ": %s>", safe_strerror (errcode)); } } |