public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: Merge C++ conversion into trunk (0/6 - Overview)
       [not found] <20120812200427.GA12561@google.com>
@ 2012-08-15 12:01 ` Richard Guenther
  2012-08-15 12:19   ` Diego Novillo
  2012-08-15 14:25   ` Mike Stump
  0 siblings, 2 replies; 16+ messages in thread
From: Richard Guenther @ 2012-08-15 12:01 UTC (permalink / raw)
  To: Diego Novillo
  Cc: gcc-patches, Lawrence Crowl, bonzini, dj, tromey, laurynas.biveinis, gdb

On Sun, 12 Aug 2012, Diego Novillo wrote:

> I will be sending 6 patches that implement all the changes we
> have been making on the cxx-conversion branch.  As described in 
> http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, these patches
> change the default bootstrap process so that stage 1 always
> builds with a C++ compiler.
> 
> Other than the bootstrap change, the patches make no functional
> changes to the compiler.  Everything should build as it does now
> in trunk.

...

and debugging becomes a nightmare (hello gdb people!)

(gdb) call debug_tree (*expr_p)
 <integer_cst 0x7ffff695d7c0 type <integer_type 0x7ffff67fa5e8 int> 
constant 9>
(gdb) call debug_tree (0x7ffff67fa5e8)
Cannot resolve function debug_tree to any overloaded instance

filing bugs does not help (as usual).  
http://sourceware.org/bugzilla/show_bug.cgi?id=13356

It's a year old, to prep for this change.  Now we're here.  Debugging
sucks.

Great.
Richard.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 12:01 ` Merge C++ conversion into trunk (0/6 - Overview) Richard Guenther
@ 2012-08-15 12:19   ` Diego Novillo
  2012-08-15 12:21     ` Richard Guenther
  2012-08-15 14:25   ` Mike Stump
  1 sibling, 1 reply; 16+ messages in thread
From: Diego Novillo @ 2012-08-15 12:19 UTC (permalink / raw)
  To: Richard Guenther
  Cc: gcc-patches, Lawrence Crowl, bonzini, dj, tromey, laurynas.biveinis, gdb

On 12-08-15 07:59 , Richard Guenther wrote:

> (gdb) call debug_tree (*expr_p)
>   <integer_cst 0x7ffff695d7c0 type <integer_type 0x7ffff67fa5e8 int>
> constant 9>
> (gdb) call debug_tree (0x7ffff67fa5e8)
> Cannot resolve function debug_tree to any overloaded instance

Yeah, in the absence of overloads this is annoying.  Happens with 0, too.


Diego.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 12:19   ` Diego Novillo
@ 2012-08-15 12:21     ` Richard Guenther
  2012-08-15 12:23       ` Diego Novillo
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Guenther @ 2012-08-15 12:21 UTC (permalink / raw)
  To: Diego Novillo
  Cc: gcc-patches, Lawrence Crowl, bonzini, dj, tromey, laurynas.biveinis, gdb

On Wed, 15 Aug 2012, Diego Novillo wrote:

> On 12-08-15 07:59 , Richard Guenther wrote:
> 
> > (gdb) call debug_tree (*expr_p)
> >   <integer_cst 0x7ffff695d7c0 type <integer_type 0x7ffff67fa5e8 int>
> > constant 9>
> > (gdb) call debug_tree (0x7ffff67fa5e8)
> > Cannot resolve function debug_tree to any overloaded instance
> 
> Yeah, in the absence of overloads this is annoying.  Happens with 0, too.

0 is fixed if you have recent enough gdb.

(gdb) call debug_tree (0)

as 0 is a null pointer constant.

Richard.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 12:21     ` Richard Guenther
@ 2012-08-15 12:23       ` Diego Novillo
  2012-08-15 15:13         ` Jan Kratochvil
  2012-08-15 17:54         ` Tom Tromey
  0 siblings, 2 replies; 16+ messages in thread
From: Diego Novillo @ 2012-08-15 12:23 UTC (permalink / raw)
  To: Richard Guenther
  Cc: gcc-patches, Lawrence Crowl, bonzini, dj, tromey, laurynas.biveinis, gdb

On 12-08-15 08:18 , Richard Guenther wrote:

> 0 is fixed if you have recent enough gdb.
>
> (gdb) call debug_tree (0)
>
> as 0 is a null pointer constant.

Oh, cool.  Progress.

GDB folks, would it be hard to figure out that there is a single variant 
of the called function and trust the user that they are passing the 
right pointer value?


Diego.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 12:01 ` Merge C++ conversion into trunk (0/6 - Overview) Richard Guenther
  2012-08-15 12:19   ` Diego Novillo
@ 2012-08-15 14:25   ` Mike Stump
  1 sibling, 0 replies; 16+ messages in thread
From: Mike Stump @ 2012-08-15 14:25 UTC (permalink / raw)
  To: Diego Novillo
  Cc: GCC Patches, Lawrence Crowl, Paolo Bonzini, DJ Delorie,
	Tom Tromey, Laurynas Biveinis, gdb, Richard Guenther

On Aug 15, 2012, at 4:59 AM, Richard Guenther wrote:
> and debugging becomes a nightmare (hello gdb people!)

> (gdb) call debug_tree (0x7ffff67fa5e8)
> Cannot resolve function debug_tree to any overloaded instance

Inquiring minds want to know if:

macro define debug_tree(A) ((tree)A)

makes the above work if you put it into gdbinit.in?  If yes, then, I think for now we should add such lines for every non-overloaded function, I too like using hex constants from dumps.  Oh, or, maybe we just add a debug_tree(long) overload just to satisfy gdb.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 12:23       ` Diego Novillo
@ 2012-08-15 15:13         ` Jan Kratochvil
  2012-08-15 15:44           ` Michael Matz
  2012-08-15 17:54         ` Tom Tromey
  1 sibling, 1 reply; 16+ messages in thread
From: Jan Kratochvil @ 2012-08-15 15:13 UTC (permalink / raw)
  To: Diego Novillo
  Cc: Richard Guenther, gcc-patches, Lawrence Crowl, bonzini, dj,
	tromey, laurynas.biveinis, gdb

On Wed, 15 Aug 2012 14:23:37 +0200, Diego Novillo wrote:
> GDB folks, would it be hard to figure out that there is a single
> variant of the called function and trust the user that they are
> passing the right pointer value?

It is a needless violation of C++ resolving rules.  There are various easy way
how to get it working (in .gdbinit or cc1-gdb.gdb define GDB function, define
macro in GDB, use GDB python pretty printer instead (possibly even calling GCC
inferior function) etc.).

While I did not post such patch yet I would prefer to even forbid by default
expressions like
	(gdb) print *0x1234567
and enforce
	(gdb) print *(int *)0x1234567
instead as the former syntax confuses people (as commonly seen on IRC), the
same applies to calling functions without full debuginfo (they should require
an explicit cast in GDB) etc.


Regards,
Jan

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 15:13         ` Jan Kratochvil
@ 2012-08-15 15:44           ` Michael Matz
  2012-08-15 15:50             ` Jan Kratochvil
  2012-08-15 16:00             ` Diego Novillo
  0 siblings, 2 replies; 16+ messages in thread
From: Michael Matz @ 2012-08-15 15:44 UTC (permalink / raw)
  To: Jan Kratochvil
  Cc: Diego Novillo, Richard Guenther, gcc-patches, Lawrence Crowl,
	bonzini, dj, tromey, laurynas.biveinis, gdb

Hi,

On Wed, 15 Aug 2012, Jan Kratochvil wrote:

> It is a needless violation of C++ resolving rules.

It's not needless as the examples here show.  gdb is about helping people 
debug their stuff, not about language lawyering.

> There are various easy way how to get it working (in .gdbinit or 
> cc1-gdb.gdb define GDB function, define macro in GDB, use GDB python 
> pretty printer instead (possibly even calling GCC inferior function) 

We should define gdb macros for every not-overloaded function (which are 
_all_ GCC functions currently)?  Doesn't scale.


Ciao,
Michael.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 15:44           ` Michael Matz
@ 2012-08-15 15:50             ` Jan Kratochvil
  2012-08-15 16:39               ` Jakub Jelinek
  2012-08-15 16:00             ` Diego Novillo
  1 sibling, 1 reply; 16+ messages in thread
From: Jan Kratochvil @ 2012-08-15 15:50 UTC (permalink / raw)
  To: Michael Matz
  Cc: Diego Novillo, Richard Guenther, gcc-patches, Lawrence Crowl,
	bonzini, dj, tromey, laurynas.biveinis, gdb

Hi,

On Wed, 15 Aug 2012 17:44:32 +0200, Michael Matz wrote:
> On Wed, 15 Aug 2012, Jan Kratochvil wrote:
> It's not needless as the examples here show.  gdb is about helping people 
> debug their stuff, not about language lawyering.

In such case there should be a GDB setting for it as at least from my opinion
it complicates the debugging.  Then there may be different opinions what
should be the default.


Thanks,
Jan

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 15:44           ` Michael Matz
  2012-08-15 15:50             ` Jan Kratochvil
@ 2012-08-15 16:00             ` Diego Novillo
  1 sibling, 0 replies; 16+ messages in thread
From: Diego Novillo @ 2012-08-15 16:00 UTC (permalink / raw)
  To: Michael Matz
  Cc: Jan Kratochvil, Richard Guenther, gcc-patches, Lawrence Crowl,
	bonzini, dj, tromey, laurynas.biveinis, gdb

On 12-08-15 11:44 , Michael Matz wrote:
> Hi,
>
> On Wed, 15 Aug 2012, Jan Kratochvil wrote:
>
>> It is a needless violation of C++ resolving rules.
>
> It's not needless as the examples here show.  gdb is about helping people
> debug their stuff, not about language lawyering.

Agreed.  If I'm passing a numeric pointer constant, I'm already past the 
bleeding edge.  I don't want gdb to get in the way.  If the inferior 
call crashes, I get to keep both pieces.


Thanks.  Diego.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 15:50             ` Jan Kratochvil
@ 2012-08-15 16:39               ` Jakub Jelinek
  0 siblings, 0 replies; 16+ messages in thread
From: Jakub Jelinek @ 2012-08-15 16:39 UTC (permalink / raw)
  To: Jan Kratochvil
  Cc: Michael Matz, Diego Novillo, Richard Guenther, gcc-patches,
	Lawrence Crowl, bonzini, dj, tromey, laurynas.biveinis, gdb

On Wed, Aug 15, 2012 at 05:49:34PM +0200, Jan Kratochvil wrote:
> On Wed, 15 Aug 2012 17:44:32 +0200, Michael Matz wrote:
> > On Wed, 15 Aug 2012, Jan Kratochvil wrote:
> > It's not needless as the examples here show.  gdb is about helping people 
> > debug their stuff, not about language lawyering.
> 
> In such case there should be a GDB setting for it as at least from my opinion
> it complicates the debugging.  Then there may be different opinions what
> should be the default.

That would be fine for gcc development purposes.  We could switch that mode
on at the end of gcc .gdbinit .

	Jakub

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 12:23       ` Diego Novillo
  2012-08-15 15:13         ` Jan Kratochvil
@ 2012-08-15 17:54         ` Tom Tromey
  2012-08-15 18:02           ` Gabriel Dos Reis
  1 sibling, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2012-08-15 17:54 UTC (permalink / raw)
  To: Diego Novillo
  Cc: Richard Guenther, gcc-patches, Lawrence Crowl, bonzini, dj,
	laurynas.biveinis, gdb

>>>>> "Diego" == Diego Novillo <dnovillo@google.com> writes:

Diego> GDB folks, would it be hard to figure out that there is a single
Diego> variant of the called function and trust the user that they are
Diego> passing the right pointer value?

I asked Keith to resurrect his patch for this.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 17:54         ` Tom Tromey
@ 2012-08-15 18:02           ` Gabriel Dos Reis
  2012-08-15 18:21             ` Tom Tromey
  0 siblings, 1 reply; 16+ messages in thread
From: Gabriel Dos Reis @ 2012-08-15 18:02 UTC (permalink / raw)
  To: Tom Tromey
  Cc: Diego Novillo, Richard Guenther, gcc-patches, Lawrence Crowl,
	bonzini, dj, laurynas.biveinis, gdb

On Wed, Aug 15, 2012 at 12:53 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Diego" == Diego Novillo <dnovillo@google.com> writes:
>
> Diego> GDB folks, would it be hard to figure out that there is a single
> Diego> variant of the called function and trust the user that they are
> Diego> passing the right pointer value?
>
> I asked Keith to resurrect his patch for this.

Since people are concerned about typing rules, would it
be an option for GDB to allow people to input pointer
literals with the "p" suffix (or "0p" prefix instead of "0x")?

-- Gaby

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 18:02           ` Gabriel Dos Reis
@ 2012-08-15 18:21             ` Tom Tromey
  2012-08-15 18:26               ` Gabriel Dos Reis
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2012-08-15 18:21 UTC (permalink / raw)
  To: Gabriel Dos Reis
  Cc: Diego Novillo, Richard Guenther, gcc-patches, Lawrence Crowl,
	bonzini, dj, laurynas.biveinis, gdb, Keith Seitz

>>>>> "Gaby" == Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

Tom> I asked Keith to resurrect his patch for this.

Gaby> Since people are concerned about typing rules, would it
Gaby> be an option for GDB to allow people to input pointer
Gaby> literals with the "p" suffix (or "0p" prefix instead of "0x")?

I think on the whole I'd rather have one extension instead of two.

It seems to me that the above would still require extensions in the
overloading code, to deal with conversions from void*; or perhaps some
magic pointer type.

What I think Keith is going to do is take his patch, change it so that
int->pointer conversions (if the int != 0) are given a different badness
from other conversions (meaning that, in theory, this should only be
chosen as a last resort, and shouldn't interfere with ordinary uses),
and finally add a parameter so that the feature can be disabled.

I hope this will be acceptable all around.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 18:21             ` Tom Tromey
@ 2012-08-15 18:26               ` Gabriel Dos Reis
  2012-08-17 17:45                 ` Keith Seitz
  0 siblings, 1 reply; 16+ messages in thread
From: Gabriel Dos Reis @ 2012-08-15 18:26 UTC (permalink / raw)
  To: Tom Tromey
  Cc: Diego Novillo, Richard Guenther, gcc-patches, Lawrence Crowl,
	bonzini, dj, laurynas.biveinis, gdb, Keith Seitz

On Wed, Aug 15, 2012 at 1:21 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Gaby" == Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
>
> Tom> I asked Keith to resurrect his patch for this.
>
> Gaby> Since people are concerned about typing rules, would it
> Gaby> be an option for GDB to allow people to input pointer
> Gaby> literals with the "p" suffix (or "0p" prefix instead of "0x")?
>
> I think on the whole I'd rather have one extension instead of two.

That is a fair point :-)

>
> It seems to me that the above would still require extensions in the
> overloading code, to deal with conversions from void*; or perhaps some
> magic pointer type.
>
> What I think Keith is going to do is take his patch, change it so that
> int->pointer conversions (if the int != 0) are given a different badness
> from other conversions (meaning that, in theory, this should only be
> chosen as a last resort, and shouldn't interfere with ordinary uses),
> and finally add a parameter so that the feature can be disabled.
>
> I hope this will be acceptable all around.

OK, that sounds reasonable.

Thanks!

-- Gaby

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-15 18:26               ` Gabriel Dos Reis
@ 2012-08-17 17:45                 ` Keith Seitz
  2012-08-17 17:56                   ` H.J. Lu
  0 siblings, 1 reply; 16+ messages in thread
From: Keith Seitz @ 2012-08-17 17:45 UTC (permalink / raw)
  To: gdb
  Cc: Gabriel Dos Reis, Tom Tromey, Diego Novillo, Richard Guenther,
	gcc-patches, Lawrence Crowl, bonzini, dj, laurynas.biveinis

On 08/15/2012 11:25 AM, Gabriel Dos Reis wrote:
> On Wed, Aug 15, 2012 at 1:21 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>>> "Gaby" == Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
>>
>> Tom> I asked Keith to resurrect his patch for this.
[snip]
>> I hope this will be acceptable all around.
>
> OK, that sounds reasonable.

I have committed a patch which should allow you to do this and closed 
c++/13356. If there are any further problems/issues, please let me know.

We've re-purposed an old, unused option, "check type". This option does 
absolutely nothing in older versions of gdb, so setting it 
unconditionally is safe for all recent versions of gdb: "set check type 
off".

Keith

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Merge C++ conversion into trunk (0/6 - Overview)
  2012-08-17 17:45                 ` Keith Seitz
@ 2012-08-17 17:56                   ` H.J. Lu
  0 siblings, 0 replies; 16+ messages in thread
From: H.J. Lu @ 2012-08-17 17:56 UTC (permalink / raw)
  To: Keith Seitz
  Cc: gdb, Gabriel Dos Reis, Tom Tromey, Diego Novillo,
	Richard Guenther, gcc-patches, Lawrence Crowl, bonzini, dj,
	laurynas.biveinis

On Fri, Aug 17, 2012 at 10:45 AM, Keith Seitz <keiths@redhat.com> wrote:
> On 08/15/2012 11:25 AM, Gabriel Dos Reis wrote:
>>
>> On Wed, Aug 15, 2012 at 1:21 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>>>>
>>>>>>>> "Gaby" == Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
>>>
>>>
>>> Tom> I asked Keith to resurrect his patch for this.
>
> [snip]
>
>>> I hope this will be acceptable all around.
>>
>>
>> OK, that sounds reasonable.
>
>
> I have committed a patch which should allow you to do this and closed
> c++/13356. If there are any further problems/issues, please let me know.
>
> We've re-purposed an old, unused option, "check type". This option does
> absolutely nothing in older versions of gdb, so setting it unconditionally
> is safe for all recent versions of gdb: "set check type off".
>

Shouldn't it be added to GCC .gdbinit?

-- 
H.J.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-08-17 17:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20120812200427.GA12561@google.com>
2012-08-15 12:01 ` Merge C++ conversion into trunk (0/6 - Overview) Richard Guenther
2012-08-15 12:19   ` Diego Novillo
2012-08-15 12:21     ` Richard Guenther
2012-08-15 12:23       ` Diego Novillo
2012-08-15 15:13         ` Jan Kratochvil
2012-08-15 15:44           ` Michael Matz
2012-08-15 15:50             ` Jan Kratochvil
2012-08-15 16:39               ` Jakub Jelinek
2012-08-15 16:00             ` Diego Novillo
2012-08-15 17:54         ` Tom Tromey
2012-08-15 18:02           ` Gabriel Dos Reis
2012-08-15 18:21             ` Tom Tromey
2012-08-15 18:26               ` Gabriel Dos Reis
2012-08-17 17:45                 ` Keith Seitz
2012-08-17 17:56                   ` H.J. Lu
2012-08-15 14:25   ` Mike Stump

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).