This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [Fwd: gdb patch]
- To: Christopher Blizzard <blizzard at mozilla dot org>
- Subject: Re: [Fwd: gdb patch]
- From: Michael Snyder <msnyder at cygnus dot com>
- Date: Mon, 08 May 2000 09:14:07 -0700
- CC: gdb-patches at sourceware dot cygnus dot com
- Organization: Cygnus Solutions
- References: <3916DC7C.D17FE386@mozilla.org>
- Reply-To: msnyder at cygnus dot com
Christopher Blizzard wrote:
>
> Did anyone merge this in? I thought that the general consensus was that
> it was a good thing.
The general consensus is that it is a good thing, but there is
concern that it might break test suites. The last word on the
subject that I remember was that Daniel did not believe that
it would break test suites, and he was gonna go verify this.
Michael
>
> --Chris
>
> -------- Original Message --------
> Subject: gdb patch
> Date: Mon, 1 May 2000 08:24:52 -0400
> From: "Jim Nance" <jnance@nortelnetworks.com>
> To: blizzard@redhat.com
>
> Hi Chris,
> I have updated my gdb "list -w" patch to work with the gdb from RH
> 6.2.
> Could you pass it on to whereever it might need to go?
>
> Thanks,
>
> Jim
>
> ---------------------------------------------------------------
> diff -ru gdb-19991004.orig/gdb/ChangeLog gdb-19991004/gdb/ChangeLog
> --- gdb-19991004.orig/gdb/ChangeLog Thu Apr 27 16:07:06 2000
> +++ gdb-19991004/gdb/ChangeLog Thu Apr 27 16:08:32 2000
> @@ -3,6 +3,12 @@
> * remote-rdi.c (arm_rdi_open): If the angel_RDI_Open fails, close
> the serial port and raise an error. If you try to go on, you will
> stall forever down in the rdi-share code.
> +
> +2000-04-24 Jim Nance <jlnance@worldnet.att.net>
> +
> + * source.c symtab.h: Added a -w option to the list command. Allows
> + the currently executing line of code in the current stack frame to
> + be annotated.
>
> 1999-10-04 Fernando Nasser <fnasser@totem.to.cygnus.com>
>
> diff -ru gdb-19991004.orig/gdb/source.c gdb-19991004/gdb/source.c
> --- gdb-19991004.orig/gdb/source.c Thu Apr 27 16:07:07 2000
> +++ gdb-19991004/gdb/source.c Thu Apr 27 16:12:02 2000
> @@ -993,13 +993,14 @@
> /* Print source lines from the file of symtab S,
> starting with line number LINE and stopping before line number STOPLINE. */
>
> -static void print_source_lines_base PARAMS ((struct symtab * s, int line, int stopline, int noerror));
> -static void
> -print_source_lines_base (s, line, stopline, noerror)
> +void print_source_lines_base PARAMS ((struct symtab * s, int line, int stopline, int noerror, int markline));
> +void
> +print_source_lines_base (s, line, stopline, noerror, markline)
> struct symtab *s;
> int line;
> int stopline;
> int noerror;
> + int markline;
> {
> register int c;
> register int desc;
> @@ -1065,8 +1066,11 @@
> c = fgetc (stream);
> if (c == EOF)
> break;
> - last_line_listed = current_source_line;
> - printf_filtered ("%d\t", current_source_line++);
> + last_line_listed = current_source_line++;
> + if (last_line_listed != markline)
> + printf_filtered ("%d\t", last_line_listed);
> + else
> + printf_filtered ("%d >\t", last_line_listed);
> do
> {
> if (c < 040 && c != '\t' && c != '\n' && c != '\r')
> @@ -1101,7 +1105,7 @@
> #if defined(TUI)
> if (!tui_version ||
> m_winPtrIsNull (srcWin) || !srcWin->generic.isVisible)
> - print_source_lines_base (s, line, stopline, noerror);
> + print_source_lines_base (s, line, stopline, noerror, 0);
> else
> {
> TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
> @@ -1121,7 +1125,7 @@
> tuiDo ((TuiOpaqueFuncPtr) tui_vUpdateLocatorFilename, s->filename);
> }
> #else
> - print_source_lines_base (s, line, stopline, noerror);
> + print_source_lines_base (s, line, stopline, noerror, 0);
> #endif
> }
>
> @@ -1143,6 +1147,18 @@
> sals->sals[i].symtab->filename, sals->sals[i].line);
> }
>
> +static void printw (s, line, stopline, noerror)
> + struct symtab *s;
> + int line;
> + int stopline;
> + int noerror;
> +{
> + int nlines = lines_to_list / 2;
> + int bline = line > nlines ? line - nlines : 1;
> + int eline = line + nlines;
> + print_source_lines_base (s, bline, eline, noerror, line);
> +}
> +
> static void
> list_command (arg, from_tty)
> char *arg;
> @@ -1177,8 +1193,25 @@
> return;
> }
>
> - /* "l -" lists previous ten lines, the ones before the ten just listed. */
> - if (STREQ (arg, "-"))
> + /* We check for 2 cases here:
> + * "l -" lists previous ten lines, the ones before the ten just listed.
> + * "l -w" gives a context listing showing the current position.
> + */
> + if (STREQN (arg, "-", 1))
> + if (STREQ (arg, "-w"))
> + {
> + extern void (*print_frame_info_listing_hook)
> + PARAMS ((struct symtab *s, int line, int stopline, int noerror));
> + void (*savefn)
> + PARAMS ((struct symtab *s, int line, int stopline, int noerror));
> +
> + savefn = print_frame_info_listing_hook;
> + print_frame_info_listing_hook = printw;
> + frame_command (NULL, 0);
> + print_frame_info_listing_hook = savefn;
> + return;
> + }
> + else
> {
> if (current_source_symtab == 0)
> error ("No default source file yet. Do \"help list\".");
> @@ -1529,7 +1562,7 @@
> /* Match! */
> fclose (stream);
> if (tui_version)
> - print_source_lines_base (current_source_symtab, line, line + 1, 0);
> + print_source_lines_base (current_source_symtab, line, line+1, 0, 0);
> print_source_lines (current_source_symtab, line, line + 1, 0);
> set_internalvar (lookup_internalvar ("_"),
> value_from_longest (builtin_type_int,
> @@ -1639,7 +1672,7 @@
> /* Match! */
> fclose (stream);
> if (tui_version)
> - print_source_lines_base (current_source_symtab, line, line + 1, 0);
> + print_source_lines_base (current_source_symtab, line, line+1, 0, 0);
> print_source_lines (current_source_symtab, line, line + 1, 0);
> set_internalvar (lookup_internalvar ("_"),
> value_from_longest (builtin_type_int,
> @@ -1736,6 +1769,7 @@
> add_com ("list", class_files, list_command,
> concat ("List specified function or line.\n\
> With no argument, lists ten more lines after or around previous listing.\n\
> +\"list -w\" lists the currently executing line of souce code with context.\n\
> \"list -\" lists the ten lines before a previous ten-line listing.\n\
> One argument specifies a line, and ten lines are listed around that line.\n\
> Two arguments with comma between specify starting and ending lines to list.\n\
> diff -ru gdb-19991004.orig/gdb/symtab.h gdb-19991004/gdb/symtab.h
> --- gdb-19991004.orig/gdb/symtab.h Thu Apr 27 16:07:07 2000
> +++ gdb-19991004/gdb/symtab.h Thu Apr 27 16:08:32 2000
> @@ -1427,6 +1427,9 @@
> identify_source_line PARAMS ((struct symtab *, int, int, CORE_ADDR));
>
> extern void
> +print_source_lines_base PARAMS ((struct symtab *, int, int, int, int));
> +
> +extern void
> print_source_lines PARAMS ((struct symtab *, int, int, int));
>
> extern void