* Re: c++ debugging hosed
2001-11-26 15:38 ` Daniel Jacobowitz
@ 2001-11-14 20:13 ` Daniel Jacobowitz
2001-11-15 8:55 ` Daniel Berlin
2001-11-26 16:43 ` Daniel Berlin
2 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2001-11-14 20:13 UTC (permalink / raw)
To: Daniel Berlin; +Cc: Benjamin Kosnik, Eli Zaretskii, jason, libstdc++, gdb
On Sun, Nov 25, 2001 at 03:29:08PM -0500, Daniel Berlin wrote:
>
>
> On Sun, 25 Nov 2001, Benjamin Kosnik wrote:
>
> >
> > > No, it's relevant to STABS, too.
> > > It's due to not properly searching virtual baseclasses.
> > > I might still have the changes to do that somewhere, if someone wants
> > > them.
> >
> > This has been broken for some time now. I'd appreciate it if it got
> > fixed, so that C++ could be debugged properly.
> I'm sure a lot of people would.
> Unfortunately, it appears I don't have the code i had worked up to
> abstract out the base class offset finding anymore.
> What's happening is that GDB wants to know the baseclass offset, and
> the routine it uses is tuned to either gnu-v2 or hp aCC (it checks
> for something only hp's debug readers fill in, and if it doesn't find
> it, it assumes gnu-v2), and the gnu-v2 code either returns the wrong
> value (weird errors occur), or -1, which gives you "virtual baseclass
> botch"/attempts to deref int values as pointers.
>
> baseclass_offset needs to be abstracted into the cp abi model, and all
> existing uses need to use it.
Could you clarify what symptom this fix you're discussing is supposed
to solve? I thought it was the one I was working on, but
baseclass_offset actually does nothing ABI specific at all.
Meanwhile the problem that was most annoying me wasn't even covered by
the testsuite. Patch and tests coming up in the next hour.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: c++ debugging hosed
2001-11-26 15:38 ` Daniel Jacobowitz
2001-11-14 20:13 ` Daniel Jacobowitz
@ 2001-11-15 8:55 ` Daniel Berlin
2001-11-15 13:10 ` Daniel Jacobowitz
2001-11-26 16:53 ` Daniel Berlin
2001-11-26 16:43 ` Daniel Berlin
2 siblings, 2 replies; 19+ messages in thread
From: Daniel Berlin @ 2001-11-15 8:55 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Benjamin Kosnik, Eli Zaretskii, jason, libstdc++, gdb
On Mon, 26 Nov 2001, Daniel Jacobowitz wrote:
> On Sun, Nov 25, 2001 at 03:29:08PM -0500, Daniel Berlin wrote:
> >
> >
> > On Sun, 25 Nov 2001, Benjamin Kosnik wrote:
> >
> > >
> > > > No, it's relevant to STABS, too.
> > > > It's due to not properly searching virtual baseclasses.
> > > > I might still have the changes to do that somewhere, if someone wants
> > > > them.
> > >
> > > This has been broken for some time now. I'd appreciate it if it got
> > > fixed, so that C++ could be debugged properly.
> > I'm sure a lot of people would.
> > Unfortunately, it appears I don't have the code i had worked up to
> > abstract out the base class offset finding anymore.
> > What's happening is that GDB wants to know the baseclass offset, and
> > the routine it uses is tuned to either gnu-v2 or hp aCC (it checks
> > for something only hp's debug readers fill in, and if it doesn't find
> > it, it assumes gnu-v2), and the gnu-v2 code either returns the wrong
> > value (weird errors occur), or -1, which gives you "virtual baseclass
> > botch"/attempts to deref int values as pointers.
> >
> > baseclass_offset needs to be abstracted into the cp abi model, and all
> > existing uses need to use it.
>
> Could you clarify what symptom this fix you're discussing is supposed
> to solve? I thought it was the one I was working on, but
> baseclass_offset actually does nothing ABI specific at all.
I'm also quite confused how you can say this after looking at it:
baseclass_offset:
...
/* First look for the virtual baseclass pointer
in the fields. */
for (i = n_baseclasses; i < len; i++)
{
if (vb_match (type, i, basetype))
{
CORE_ADDR addr
= unpack_pointer (TYPE_FIELD_TYPE (type, i),
valaddr + (TYPE_FIELD_BITPOS (type, i) /
8));
return addr - (LONGEST) address;
}
}
Then looking above it at vb_match.
It's, in fact, the most abi specific stuff still left for C++.
It happens to basically work for non-virtual classes, but it couldn't
possibly work for virtual baseclasses (IE even if you pulled some magic in gcc to make
it still output the things vb_match was looking for, it wouldn't work
anyway.).
baseclass offset finding is a fundamental piece of C++ support in gdb.
It's required for printing things, calling methods, etc.
--Dan
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: c++ debugging hosed
2001-11-15 8:55 ` Daniel Berlin
@ 2001-11-15 13:10 ` Daniel Jacobowitz
2001-11-26 17:19 ` Daniel Jacobowitz
2001-11-26 16:53 ` Daniel Berlin
1 sibling, 1 reply; 19+ messages in thread
From: Daniel Jacobowitz @ 2001-11-15 13:10 UTC (permalink / raw)
To: Daniel Berlin; +Cc: Benjamin Kosnik, Eli Zaretskii, jason, libstdc++, gdb
On Mon, Nov 26, 2001 at 07:53:24PM -0500, Daniel Berlin wrote:
> Then looking above it at vb_match.
>
> It's, in fact, the most abi specific stuff still left for C++.
>
>
> It happens to basically work for non-virtual classes, but it couldn't
> possibly work for virtual baseclasses (IE even if you pulled some magic in gcc to make
> it still output the things vb_match was looking for, it wouldn't work
> anyway.).
>
>
> baseclass offset finding is a fundamental piece of C++ support in gdb.
> It's required for printing things, calling methods, etc.
Yes. But not, most of the time, through this function.
I agree that it needs to be fixed. I'll be back here in a few days, I
expect.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: c++ debugging hosed
2001-11-15 13:10 ` Daniel Jacobowitz
@ 2001-11-26 17:19 ` Daniel Jacobowitz
0 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2001-11-26 17:19 UTC (permalink / raw)
To: Daniel Berlin; +Cc: Benjamin Kosnik, Eli Zaretskii, jason, libstdc++, gdb
On Mon, Nov 26, 2001 at 07:53:24PM -0500, Daniel Berlin wrote:
> Then looking above it at vb_match.
>
> It's, in fact, the most abi specific stuff still left for C++.
>
>
> It happens to basically work for non-virtual classes, but it couldn't
> possibly work for virtual baseclasses (IE even if you pulled some magic in gcc to make
> it still output the things vb_match was looking for, it wouldn't work
> anyway.).
>
>
> baseclass offset finding is a fundamental piece of C++ support in gdb.
> It's required for printing things, calling methods, etc.
Yes. But not, most of the time, through this function.
I agree that it needs to be fixed. I'll be back here in a few days, I
expect.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: c++ debugging hosed
2001-11-15 8:55 ` Daniel Berlin
2001-11-15 13:10 ` Daniel Jacobowitz
@ 2001-11-26 16:53 ` Daniel Berlin
1 sibling, 0 replies; 19+ messages in thread
From: Daniel Berlin @ 2001-11-26 16:53 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Benjamin Kosnik, Eli Zaretskii, jason, libstdc++, gdb
On Mon, 26 Nov 2001, Daniel Jacobowitz wrote:
> On Sun, Nov 25, 2001 at 03:29:08PM -0500, Daniel Berlin wrote:
> >
> >
> > On Sun, 25 Nov 2001, Benjamin Kosnik wrote:
> >
> > >
> > > > No, it's relevant to STABS, too.
> > > > It's due to not properly searching virtual baseclasses.
> > > > I might still have the changes to do that somewhere, if someone wants
> > > > them.
> > >
> > > This has been broken for some time now. I'd appreciate it if it got
> > > fixed, so that C++ could be debugged properly.
> > I'm sure a lot of people would.
> > Unfortunately, it appears I don't have the code i had worked up to
> > abstract out the base class offset finding anymore.
> > What's happening is that GDB wants to know the baseclass offset, and
> > the routine it uses is tuned to either gnu-v2 or hp aCC (it checks
> > for something only hp's debug readers fill in, and if it doesn't find
> > it, it assumes gnu-v2), and the gnu-v2 code either returns the wrong
> > value (weird errors occur), or -1, which gives you "virtual baseclass
> > botch"/attempts to deref int values as pointers.
> >
> > baseclass_offset needs to be abstracted into the cp abi model, and all
> > existing uses need to use it.
>
> Could you clarify what symptom this fix you're discussing is supposed
> to solve? I thought it was the one I was working on, but
> baseclass_offset actually does nothing ABI specific at all.
I'm also quite confused how you can say this after looking at it:
baseclass_offset:
...
/* First look for the virtual baseclass pointer
in the fields. */
for (i = n_baseclasses; i < len; i++)
{
if (vb_match (type, i, basetype))
{
CORE_ADDR addr
= unpack_pointer (TYPE_FIELD_TYPE (type, i),
valaddr + (TYPE_FIELD_BITPOS (type, i) /
8));
return addr - (LONGEST) address;
}
}
Then looking above it at vb_match.
It's, in fact, the most abi specific stuff still left for C++.
It happens to basically work for non-virtual classes, but it couldn't
possibly work for virtual baseclasses (IE even if you pulled some magic in gcc to make
it still output the things vb_match was looking for, it wouldn't work
anyway.).
baseclass offset finding is a fundamental piece of C++ support in gdb.
It's required for printing things, calling methods, etc.
--Dan
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: c++ debugging hosed
2001-11-26 15:38 ` Daniel Jacobowitz
2001-11-14 20:13 ` Daniel Jacobowitz
2001-11-15 8:55 ` Daniel Berlin
@ 2001-11-26 16:43 ` Daniel Berlin
2001-11-15 8:48 ` Daniel Berlin
2001-11-26 16:53 ` Daniel Jacobowitz
2 siblings, 2 replies; 19+ messages in thread
From: Daniel Berlin @ 2001-11-26 16:43 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Benjamin Kosnik, Eli Zaretskii, jason, libstdc++, gdb
On Mon, 26 Nov 2001, Daniel Jacobowitz wrote:
> On Sun, Nov 25, 2001 at 03:29:08PM -0500, Daniel Berlin wrote:
> >
> >
> > On Sun, 25 Nov 2001, Benjamin Kosnik wrote:
> >
> > >
> > > > No, it's relevant to STABS, too.
> > > > It's due to not properly searching virtual baseclasses.
> > > > I might still have the changes to do that somewhere, if someone wants
> > > > them.
> > >
> > > This has been broken for some time now. I'd appreciate it if it got
> > > fixed, so that C++ could be debugged properly.
> > I'm sure a lot of people would.
> > Unfortunately, it appears I don't have the code i had worked up to
> > abstract out the base class offset finding anymore.
> > What's happening is that GDB wants to know the baseclass offset, and
> > the routine it uses is tuned to either gnu-v2 or hp aCC (it checks
> > for something only hp's debug readers fill in, and if it doesn't find
> > it, it assumes gnu-v2), and the gnu-v2 code either returns the wrong
> > value (weird errors occur), or -1, which gives you "virtual baseclass
> > botch"/attempts to deref int values as pointers.
> >
> > baseclass_offset needs to be abstracted into the cp abi model, and all
> > existing uses need to use it.
>
> Could you clarify what symptom this fix you're discussing is supposed
> to solve?
Not being able to print subobjects, etc.
> I thought it was the one I was working on, but
> baseclass_offset actually does nothing ABI specific at all.
This would be incorrect for virtual base classes
Look at it again.
Also notice we call find_rt_base_offset for the HP ABI.
The reason is that baseclass offsets are *always* abi specific.
>
> Meanwhile the problem that was most annoying me wasn't even covered by
> the testsuite. Patch and tests coming up in the next hour.
>
> --
> Daniel Jacobowitz Carnegie Mellon University
> MontaVista Software Debian GNU/Linux Developer
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: c++ debugging hosed
2001-11-26 16:43 ` Daniel Berlin
@ 2001-11-15 8:48 ` Daniel Berlin
2001-11-26 16:53 ` Daniel Jacobowitz
1 sibling, 0 replies; 19+ messages in thread
From: Daniel Berlin @ 2001-11-15 8:48 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Benjamin Kosnik, Eli Zaretskii, jason, libstdc++, gdb
On Mon, 26 Nov 2001, Daniel Jacobowitz wrote:
> On Sun, Nov 25, 2001 at 03:29:08PM -0500, Daniel Berlin wrote:
> >
> >
> > On Sun, 25 Nov 2001, Benjamin Kosnik wrote:
> >
> > >
> > > > No, it's relevant to STABS, too.
> > > > It's due to not properly searching virtual baseclasses.
> > > > I might still have the changes to do that somewhere, if someone wants
> > > > them.
> > >
> > > This has been broken for some time now. I'd appreciate it if it got
> > > fixed, so that C++ could be debugged properly.
> > I'm sure a lot of people would.
> > Unfortunately, it appears I don't have the code i had worked up to
> > abstract out the base class offset finding anymore.
> > What's happening is that GDB wants to know the baseclass offset, and
> > the routine it uses is tuned to either gnu-v2 or hp aCC (it checks
> > for something only hp's debug readers fill in, and if it doesn't find
> > it, it assumes gnu-v2), and the gnu-v2 code either returns the wrong
> > value (weird errors occur), or -1, which gives you "virtual baseclass
> > botch"/attempts to deref int values as pointers.
> >
> > baseclass_offset needs to be abstracted into the cp abi model, and all
> > existing uses need to use it.
>
> Could you clarify what symptom this fix you're discussing is supposed
> to solve?
Not being able to print subobjects, etc.
> I thought it was the one I was working on, but
> baseclass_offset actually does nothing ABI specific at all.
This would be incorrect for virtual base classes
Look at it again.
Also notice we call find_rt_base_offset for the HP ABI.
The reason is that baseclass offsets are *always* abi specific.
>
> Meanwhile the problem that was most annoying me wasn't even covered by
> the testsuite. Patch and tests coming up in the next hour.
>
> --
> Daniel Jacobowitz Carnegie Mellon University
> MontaVista Software Debian GNU/Linux Developer
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: c++ debugging hosed
2001-11-26 16:43 ` Daniel Berlin
2001-11-15 8:48 ` Daniel Berlin
@ 2001-11-26 16:53 ` Daniel Jacobowitz
2001-11-15 9:57 ` Daniel Jacobowitz
1 sibling, 1 reply; 19+ messages in thread
From: Daniel Jacobowitz @ 2001-11-26 16:53 UTC (permalink / raw)
To: Daniel Berlin; +Cc: Benjamin Kosnik, Eli Zaretskii, jason, libstdc++, gdb
On Mon, Nov 26, 2001 at 07:43:39PM -0500, Daniel Berlin wrote:
>
>
> On Mon, 26 Nov 2001, Daniel Jacobowitz wrote:
> > Could you clarify what symptom this fix you're discussing is supposed
> > to solve?
> Not being able to print subobjects, etc.
OK, I'm just printing objects right now :)
> > I thought it was the one I was working on, but
> > baseclass_offset actually does nothing ABI specific at all.
> This would be incorrect for virtual base classes
> Look at it again.
> Also notice we call find_rt_base_offset for the HP ABI.
> The reason is that baseclass offsets are *always* abi specific.
(it's find_rt_vbase_offset)
OK, this isn't in baseclass_offset. I assume you mean
search_struct_method or find_method_list.
I'll get back to this in a few days when I fix my current bug.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: c++ debugging hosed
2001-11-26 16:53 ` Daniel Jacobowitz
@ 2001-11-15 9:57 ` Daniel Jacobowitz
0 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2001-11-15 9:57 UTC (permalink / raw)
To: Daniel Berlin; +Cc: Benjamin Kosnik, Eli Zaretskii, jason, libstdc++, gdb
On Mon, Nov 26, 2001 at 07:43:39PM -0500, Daniel Berlin wrote:
>
>
> On Mon, 26 Nov 2001, Daniel Jacobowitz wrote:
> > Could you clarify what symptom this fix you're discussing is supposed
> > to solve?
> Not being able to print subobjects, etc.
OK, I'm just printing objects right now :)
> > I thought it was the one I was working on, but
> > baseclass_offset actually does nothing ABI specific at all.
> This would be incorrect for virtual base classes
> Look at it again.
> Also notice we call find_rt_base_offset for the HP ABI.
> The reason is that baseclass offsets are *always* abi specific.
(it's find_rt_vbase_offset)
OK, this isn't in baseclass_offset. I assume you mean
search_struct_method or find_method_list.
I'll get back to this in a few days when I fix my current bug.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 19+ messages in thread