diff mbox

debuggability of DF_REF_LOC

Message ID 00FC38E0-14A7-4C25-AC91-35C6B9922F3E@comcast.net
State New
Headers show

Commit Message

Mike Stump May 14, 2013, 7:18 p.m. UTC
I was trying to debug with DF_REF_LOC in gdb on linux, and got:

(gdb) p DF_REF_LOC (*ref) == recog_data.operand_loc[op]
No symbol "__null" in current context.

My fingers were not amused.  I found if I did:

(gdb) macro define __null 0

then I could do:

(gdb) p DF_REF_LOC (*ref) == recog_data.operand_loc[op]
$3 = true

and my fingers were again happy.

I checked this in.
2013-05-14  Mike Stump  <mikestump@comcast.net>

	* gdbinit.in: Add __null.

------------------------------

Comments

Andrew Pinski May 14, 2013, 7:21 p.m. UTC | #1
On Tue, May 14, 2013 at 12:18 PM, Mike Stump <mikestump@comcast.net> wrote:
> I was trying to debug with DF_REF_LOC in gdb on linux, and got:
>
> (gdb) p DF_REF_LOC (*ref) == recog_data.operand_loc[op]
> No symbol "__null" in current context.
>
> My fingers were not amused.  I found if I did:
>
> (gdb) macro define __null 0
>
> then I could do:
>
> (gdb) p DF_REF_LOC (*ref) == recog_data.operand_loc[op]
> $3 = true
>
> and my fingers were again happy.
>
> I checked this in.

I think gdb should support __null anyways.  Can you see if a newer
version of gdb supports it and if it does not, please file a bug?

Thanks,
Andrew
Mike Stump May 14, 2013, 9:16 p.m. UTC | #2
On May 14, 2013, at 12:21 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> I think gdb should support __null anyways.  Can you see if a newer
> version of gdb supports it and if it does not, please file a bug?

__null is a private implementation detail of g++.  While gdb could support it, I don't think they have to.  Certainly, a consumer of dwarf isn't required to support it by the dwarf standard.  I think all handling of __null should be in the compiler.  Now, g++ could emit a -g3 style #define to 0 for it, that would also address the issue.  I think I'd rather have Jason weigh in on what he feels the right design is, he is our debug expert.  :-)
diff mbox

Patch

Index: gdbinit.in
===================================================================
--- gdbinit.in	(revision 198896)
+++ gdbinit.in	(working copy)
@@ -184,6 +184,7 @@  end
 # Define some macros helpful to gdb when it is expanding macros.
 macro define __FILE__ "gdb"
 macro define __LINE__ 1
+macro define __null 0
 
 # Gracefully handle aborts in functions used from gdb.
 set unwindonsignal on