From 6c803036a9c59b13ff6335d8745ffa92a76d86fc Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Wed, 20 Apr 1994 19:23:30 +0000 Subject: [PATCH] * main.c (main): Accept --annotate=N option and make --fullname the same as --annotate=1. (command_line_input): Print annotatation before and after prompt. * blockframe.c (flush_cached_frames): Print annotation. * Rename frame_file_full_name to annotation_level and move it from symtab.h to defs.h. * source.c (identify_source_line): If annotation_level > 1, change output format. * breakpoint.c: Print annotation whenever a breakpoint changes. * main.c: New variable server_command. (command_line_input): Parse "server " and set server_command. (dont_repeat): Check server_command. --- gdb/ChangeLog | 15 +++++++++++++ gdb/blockframe.c | 5 +++++ gdb/breakpoint.c | 33 ++++++++++++++++++++-------- gdb/defs.h | 4 +++- gdb/main.c | 57 +++++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 101 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 390b5916dec..688d89ba700 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +Mon Apr 11 10:44:35 1994 Jim Kingdon (kingdon@deneb.cygnus.com) + + * main.c (main): Accept --annotate=N option and make --fullname + the same as --annotate=1. + (command_line_input): Print annotatation before and after prompt. + * blockframe.c (flush_cached_frames): Print annotation. + * Rename frame_file_full_name to annotation_level and move it from + symtab.h to defs.h. + * source.c (identify_source_line): If annotation_level > 1, + change output format. + * breakpoint.c: Print annotation whenever a breakpoint changes. + * main.c: New variable server_command. + (command_line_input): Parse "server " and set server_command. + (dont_repeat): Check server_command. + Wed Apr 20 08:37:16 1994 Jim Kingdon (kingdon@lioth.cygnus.com) * xcoffread.c (xcoff_next_symbol_text): Don't return before diff --git a/gdb/blockframe.c b/gdb/blockframe.c index bbd428784e2..6b0b667d556 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -192,6 +192,11 @@ flush_cached_frames () obstack_init (&frame_cache_obstack); current_frame = (struct frame_info *) 0; /* Invalidate cache */ + if (annotation_level > 1) + { + target_terminal_ours (); + printf_unfiltered ("\n\032\032frames-invalid\n"); + } } /* Flush the frame cache, and start a new one if necessary. */ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index dc15de265db..b166291b379 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -196,6 +196,16 @@ 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. @@ -335,6 +345,7 @@ End with a line saying just \"end\".\n", bnum); l = read_command_lines (); free_command_lines (&b->commands); b->commands = l; + breakpoints_changed (); return; } error ("No breakpoint number %d.", bnum); @@ -1766,6 +1777,7 @@ set_raw_breakpoint (sal) } check_duplicates (sal.pc); + breakpoints_changed (); return b; } @@ -2771,6 +2783,7 @@ clear_command (arg, from_tty) if (found->next) from_tty = 1; /* Always report if deleted more than one */ if (from_tty) printf_unfiltered ("Deleted breakpoint%s ", found->next ? "s" : ""); + breakpoints_changed (); while (found) { if (from_tty) printf_unfiltered ("%d ", found->number); @@ -2854,11 +2867,7 @@ delete_breakpoint (bpt) if (bpt->source_file != NULL) free (bpt->source_file); - if (xgdb_verbose && bpt->type == bp_breakpoint) - { - target_terminal_ours_for_output (); - printf_unfiltered ("breakpoint #%d deleted\n", bpt->number); - } + breakpoints_changed (); /* Be sure no bpstat's are pointing at it after it's been freed. */ /* FIXME, how can we find all bpstat's? @@ -2962,6 +2971,10 @@ breakpoint_re_set_one (bint) check_duplicates (b->address); mention (b); + + /* Might be better to do this just once per breakpoint_re_set, + rather than once for every breakpoint. */ + breakpoints_changed (); } b->enable = save_enable; /* Restore it, this worked. */ } @@ -3067,6 +3080,7 @@ set_ignore_count (bptnum, count, from_tty) else printf_filtered ("Will ignore next %d crossings of breakpoint %d.", count, bptnum); + breakpoints_changed (); return; } @@ -3105,6 +3119,7 @@ ignore_command (args, from_tty) longest_to_int (value_as_long (parse_and_eval (p))), from_tty); printf_filtered ("\n"); + breakpoints_changed (); } /* Call FUNCTION on each of the breakpoints @@ -3153,8 +3168,7 @@ enable_breakpoint (bpt) bpt->enable = enabled; - if (xgdb_verbose && bpt->type == bp_breakpoint) - printf_unfiltered ("breakpoint #%d enabled\n", bpt->number); + breakpoints_changed (); check_duplicates (bpt->address); if (bpt->type == bp_watchpoint || bpt->type == bp_hardware_watchpoint) @@ -3222,8 +3236,7 @@ disable_breakpoint (bpt) bpt->enable = disabled; - if (xgdb_verbose && bpt->type == bp_breakpoint) - printf_filtered ("breakpoint #%d disabled\n", bpt->number); + breakpoints_changed (); check_duplicates (bpt->address); } @@ -3258,6 +3271,7 @@ enable_once_breakpoint (bpt) bpt->disposition = disable; check_duplicates (bpt->address); + breakpoints_changed (); } /* ARGSUSED */ @@ -3277,6 +3291,7 @@ enable_delete_breakpoint (bpt) bpt->disposition = delete; check_duplicates (bpt->address); + breakpoints_changed (); } /* ARGSUSED */ diff --git a/gdb/defs.h b/gdb/defs.h index d3704346d53..f05311258f1 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -215,7 +215,9 @@ myread PARAMS ((int, char *, int)); extern int query (); - + +extern int annotation_level; /* in stack.c */ + extern void begin_line PARAMS ((void)); diff --git a/gdb/main.c b/gdb/main.c index 38771daed2b..69c36ef313c 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -308,6 +308,14 @@ static char *prompt; char *line; int linesize = 100; +/* Nonzero if the current command is modified by "server ". This + affects things like recording into the command history, comamnds + repeating on RETURN, etc. This is so a user interface (emacs, GUI, + whatever) can issue its own commands and also send along commands + from the user, and have the user not notice that the user interface + is issuing commands too. */ +int server_command; + /* Baud rate specified for talking to serial target systems. Default is left as -1, so targets can choose their own defaults. */ /* FIXME: This means that "show remotebaud" and gr_files_info can print -1 @@ -604,8 +612,14 @@ main (argc, argv) {"n", no_argument, &inhibit_gdbinit, 1}, {"batch", no_argument, &batch, 1}, {"epoch", no_argument, &epoch_interface, 1}, - {"fullname", no_argument, &frame_file_full_name, 1}, - {"f", no_argument, &frame_file_full_name, 1}, + + /* This is a synonym for "--annotate=1". --annotate is now preferred, + but keep this here for a long time because people will be running + emacses which use --fullname. */ + {"fullname", no_argument, 0, 'f'}, + {"f", no_argument, 0, 'f'}, + + {"annotate", required_argument, 0, 12}, {"help", no_argument, &print_help, 1}, {"se", required_argument, 0, 10}, {"symbols", required_argument, 0, 's'}, @@ -654,6 +668,13 @@ main (argc, argv) case 11: cdarg = optarg; break; + case 12: + /* FIXME: what if the syntax is wrong (e.g. not digits)? */ + annotation_level = atoi (optarg); + break; + case 'f': + annotation_level = 1; + break; case 's': symarg = optarg; break; @@ -1113,6 +1134,9 @@ command_loop () void dont_repeat () { + if (server_command) + return; + /* If we aren't reading from standard input, we are saving the last thing read from stdin in line and don't want to delete it. Null lines won't repeat here in any case. */ @@ -1681,6 +1705,13 @@ command_line_input (prrompt, repeat) char *nline; char got_eof = 0; + if (annotation_level > 1 && prrompt != NULL) + { + local_prompt = alloca (strlen (prrompt) + 20); + strcpy (local_prompt, prrompt); + strcat (local_prompt, "\n\032\032prompt\n"); + } + if (linebuffer == 0) { linelength = 80; @@ -1717,6 +1748,9 @@ command_line_input (prrompt, repeat) error_pre_print = source_error; } + if (annotation_level > 1 && instream == stdin) + printf_unfiltered ("\n\032\032pre-prompt\n"); + /* Don't use fancy stuff if not talking to stdin. */ if (command_editing_p && instream == stdin && ISATTY (instream)) @@ -1724,6 +1758,9 @@ command_line_input (prrompt, repeat) else rl = gdb_readline (local_prompt); + if (annotation_level > 1 && instream == stdin) + printf_unfiltered ("\n\032\032post-prompt\n"); + if (!rl || rl == (char *) EOF) { got_eof = 1; @@ -1760,6 +1797,19 @@ command_line_input (prrompt, repeat) if (got_eof) return NULL; +#define SERVER_COMMAND_LENGTH 7 + server_command = + (p - linebuffer > SERVER_COMMAND_LENGTH) + && STREQN (linebuffer, "server ", SERVER_COMMAND_LENGTH); + if (server_command) + { + /* Note that we don't set `line'. Between this and the check in + dont_repeat, this insures that repeating will still do the + right thing. */ + *p = '\0'; + return linebuffer + SERVER_COMMAND_LENGTH; + } + /* Do history expansion if that is wished. */ if (history_expansion_p && instream == stdin && ISATTY (instream)) @@ -2245,7 +2295,8 @@ show_version (args, from_tty) immediate_quit--; } -/* xgdb calls this to reprint the usual GDB prompt. */ +/* xgdb calls this to reprint the usual GDB prompt. Obsolete now that xgdb + is obsolete. */ void print_prompt () -- 2.30.2