This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add support to control auto-display behavior


This patch is to allow setting how auto-displays are affected when memory is
not accessible. It's very common to, when single-stepping, or stepping over,
initially setup some auto-displays and then begin stepping. I don't see
any reason why, in the event an object is not accessible, the auto-display
should be disabled. I know that the actual error is "To prevent infinite
recursion" but I'm not finding how that will happen based on the already
present code. Is it something from the past?  

Basically, it does the following:

(gdb) b main
Breakpoint 1 at 0x8048371: file null.c, line 5.
(gdb) r

Breakpoint 1, main () at null.c:5
5               char buf[][64] = { "foo", "bar" };
(gdb) set display strict off
(gdb) disp q
(gdb) disp *q
(gdb) n
6               char *q = NULL;
2: *q = -115 '\215'
1: q = 0x8048426 "\215\203 ÿÿÿ\215"
(gdb)
8               q = NULL;
2: *q = Cannot access memory at address 0x0
1: q = 0x0
(gdb)
9               q = buf[0];
2: *q = Cannot access memory at address 0x0
1: q = 0x0
(gdb)
10              q = buf[1];
2: *q = 102 'f'
1: q = 0xbfeec3fc "foo"
(gdb)
11              q = (void *)0xDEAD;
2: *q = 98 'b'
1: q = 0xbfeec43c "bar"
(gdb)
13              return 0;
2: *q = Cannot access memory at address 0xdead
1: q = 0xdead <Address 0xdead out of bounds>
(gdb)


Additionally, in the exercising of implementing it, it also fixes a "bug"
where if a display is disabled, as per default behavior, the rest
of the valid displays will still be displayed. Previously things would
just stop at the first exception caught.

(gdb) set display strict on
(gdb) n
8               q = NULL;
Disabling display 2 to avoid infinite recursion.
2: *q = Cannot access memory at address 0x0
1: q = 0x0


gdb/ChangeLog:

2007-03-30  Christopher Layne  <clayne@anodized.com>

	* cli/cli-cmds.c (setdisplaylist): Define.
	(showdisplaylist): Define.
	(init_cmd_lists): Initialize both.
	* cli/cli-cmds.h (setdisplaylist): Declare.
	(showdisplaylist): Declare.
	* gdbcmd.h (setdisplaylist): Declare.
	(showdisplaylist): Declare.
	* printcmd.c (exceptions.h): Include.
	(display_strict): Define and initialize.
	(show_display_strict): New function.
	(show_display): New function.
	(set_display): New function.
	(do_one_display): Change prototype to be compatible with
	catch_errors(). Change return values to fit new prototype.
	(do_displays): Wrap do_one_display in catch_errors().
	(disable_current_display): Check value of display_strict first.
	(_initialize_printcmd): Add prefix commands for controlling
	auto-displays and value of display_strict. Default display_strict to 1.

gdb/doc/ChangeLog:

2007-03-30  Christopher Layne  <clayne@anodized.com>

	* gdb.texinfo (Display Settings): Add documentation for manipulating
	auto-displays.

-cl

Attachment: gdb.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]