This is the mail archive of the
mailing list for the GDB project.
Re: Language of registers
- From: Jim Ingham <jingham at apple dot com>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 1 Dec 2006 10:02:44 -0800
- Subject: Re: Language of registers
- References: <firstname.lastname@example.org> <20061127140344.GA32528@nevyn.them.org> <email@example.com> <20061128172327.GG21834@nevyn.them.org> <firstname.lastname@example.org> <20061201143219.GA25854@nevyn.them.org>
The way I dealt with this for Xcode was to have gdb automatically
"turn out" all varobj's that have only public fields. I actually
added a flag to do this for all the fake children regardless of
protection type, since some people got really ticked off at them,
though other people liked them...
$ cat main.cpp
int main ()
struct foo * mine = new foo();
mine->first = 5;
mine->second = 10;
$ g++ -g -O0 main.cpp
$ gdb a.out
(gdb) break main
Breakpoint 1 at 0x1ef8: file main.cpp, line 9.
Starting program: /private/tmp/a.out
Reading symbols for shared libraries . done
Breakpoint 1, main () at main.cpp:9
9 struct foo * mine = new foo();
11 mine->first = 5;
12 mine->second = 10;
14 return 0;
(gdb) set interpreter mi1
-var-create - * mine
The one little quirk with this is that the "numchild" field in the
parent object might not be accurate. But it turned out at least Xcode
didn't really use that anyway, it just iterated over whatever it got
In the long run it might be a good idea to rip the fake children out
altogether. I liked them when Keith was first doing this stuff, but
they don't seem all that popular. Anyway, just expanding them
automatically was a pretty simple and non-intrusive fix, and from the
UI standpoint pretty much solves whatever problems folks were having
with the fake children...
On Dec 1, 2006, at 6:32 AM, Daniel Jacobowitz wrote:
The change does not seem very complex, but the changes to
be huge, so I'd like to check. Does everybody agree with removing
"public" pseudo-field from structures that have only public fields?
We can't tell reliably if something was declared as "struct" or
in the source, but I think unions default to public, don't they?
The *default* to public, but you can have private members in a union.
That's what I meant. We can see "oh, this is a union" -> "its default
is public". We don't know for sure if a source construct was "struct"
(public by default) or "class", though. But it sounds like we can't
remove the public child now anyway.