* GDB support: Couldn't find method
@ 2018-08-04 11:48 Viesturs Veckalns
2018-08-08 0:27 ` Simon Marchi
2018-08-20 15:13 ` Pedro Alves
0 siblings, 2 replies; 5+ messages in thread
From: Viesturs Veckalns @ 2018-08-04 11:48 UTC (permalink / raw)
To: gdb
Hello!
I compile a binary by linking a library:
-L${LIBDIR}/lib -lCompoundHisto
In the debug session the library is listed under
info sharedlibrary
Additionally, I requested to read symbols from the relevant source files by
set debug-file-directory ${LIBDIR}/interface
set debug-file-directory ${LIBDIR}/src
Nevertheless, I encounter the following problem:
p GetLevel(resultcode) -> GetHU(mo)
Couldn't find method CompoundHistoUnfolding::Level::GetHU
The methods are described in the source to build libCompoundHisto.so
What is wrong?
My gdb version is 7.11.
Viesturs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB support: Couldn't find method
2018-08-04 11:48 GDB support: Couldn't find method Viesturs Veckalns
@ 2018-08-08 0:27 ` Simon Marchi
2018-08-08 11:15 ` Viesturs Veckalns
2018-08-20 15:13 ` Pedro Alves
1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2018-08-08 0:27 UTC (permalink / raw)
To: Viesturs Veckalns; +Cc: gdb
On 2018-08-04 07:48, Viesturs Veckalns wrote:
> Hello!
> I compile a binary by linking a library:
>
> -L${LIBDIR}/lib -lCompoundHisto
>
> In the debug session the library is listed under
>
> info sharedlibrary
>
> Additionally, I requested to read symbols from the relevant source
> files by
>
> set debug-file-directory ${LIBDIR}/interface
> set debug-file-directory ${LIBDIR}/src
>
> Nevertheless, I encounter the following problem:
>
> p GetLevel(resultcode) -> GetHU(mo)
> Couldn't find method CompoundHistoUnfolding::Level::GetHU
>
> The methods are described in the source to build libCompoundHisto.so
>
> What is wrong?
>
> My gdb version is 7.11.
> Viesturs
Hi Viesturs,
A sanity check to see if GDB knows about any GetHU method would to do
(gdb) ptype GetLevel(resultcode)
or
(gdb) ptype CompoundHistoUnfolding::Level
Do you see GetHU listed?
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: GDB support: Couldn't find method
2018-08-08 0:27 ` Simon Marchi
@ 2018-08-08 11:15 ` Viesturs Veckalns
2018-08-20 15:03 ` Simon Marchi
0 siblings, 1 reply; 5+ messages in thread
From: Viesturs Veckalns @ 2018-08-08 11:15 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb
Hello Simon,
It turns out gdb does not know anything about class methods and nested classes loaded from the shared library:
(gdb) ptype GetLevel(resultcode)
type = struct CompoundHistoUnfolding::Level {
<incomplete type>
} *
(gdb) ptype CompoundHistoUnfolding::Level
There is no field named Level
gdb can list members of class CompoundHistoUnfolding but does not know about classes interfaced with the #include directive:
(gdb) ptype CompoundHistoUnfolding
type = class CompoundHistoUnfolding : public TNamed {
private:
Python Exception <class 'gdb.error'> No type named TString.:
std::map<TString, HistoUnfolding*, std::less<TString>, std::allocator<std::pair<TString const, HistoUnfolding*> > > aggrbackgroundMC;
Python Exception <class 'gdb.error'> No type named HistoUnfolding*.:
std::vector<HistoUnfolding*, std::allocator<HistoUnfolding*> > _vbackgroundhistos;
Python Exception <class 'gdb.error'> No type named SampleDescriptor*.:
std::vector<SampleDescriptor*, std::allocator<SampleDescriptor*> > _expsyssamples;
std::vector<SampleDescriptor*, std::allocator<SampleDescriptor*> > _markedsyssamples;
HistoUnfoldingTH2 *totalbackground;
char _signal_title[64];
...
How to proceed from this point?
Viesturs
________________________________________
From: Simon Marchi [simon.marchi@polymtl.ca]
Sent: 08 August 2018 02:27
To: Viesturs Veckalns
Cc: gdb@sourceware.org
Subject: Re: GDB support: Couldn't find method
On 2018-08-04 07:48, Viesturs Veckalns wrote:
> Hello!
> I compile a binary by linking a library:
>
> -L${LIBDIR}/lib -lCompoundHisto
>
> In the debug session the library is listed under
>
> info sharedlibrary
>
> Additionally, I requested to read symbols from the relevant source
> files by
>
> set debug-file-directory ${LIBDIR}/interface
> set debug-file-directory ${LIBDIR}/src
>
> Nevertheless, I encounter the following problem:
>
> p GetLevel(resultcode) -> GetHU(mo)
> Couldn't find method CompoundHistoUnfolding::Level::GetHU
>
> The methods are described in the source to build libCompoundHisto.so
>
> What is wrong?
>
> My gdb version is 7.11.
> Viesturs
Hi Viesturs,
A sanity check to see if GDB knows about any GetHU method would to do
(gdb) ptype GetLevel(resultcode)
or
(gdb) ptype CompoundHistoUnfolding::Level
Do you see GetHU listed?
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB support: Couldn't find method
2018-08-08 11:15 ` Viesturs Veckalns
@ 2018-08-20 15:03 ` Simon Marchi
0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2018-08-20 15:03 UTC (permalink / raw)
To: Viesturs Veckalns; +Cc: gdb
On 2018-08-08 07:14, Viesturs Veckalns wrote:
> Hello Simon,
> It turns out gdb does not know anything about class methods and nested
> classes loaded from the shared library:
>
> (gdb) ptype GetLevel(resultcode)
> type = struct CompoundHistoUnfolding::Level {
> <incomplete type>
> } *
> (gdb) ptype CompoundHistoUnfolding::Level
> There is no field named Level
>
> gdb can list members of class CompoundHistoUnfolding but does not know
> about classes interfaced with the #include directive:
>
> (gdb) ptype CompoundHistoUnfolding
> type = class CompoundHistoUnfolding : public TNamed {
> private:
> Python Exception <class 'gdb.error'> No type named TString.:
> std::map<TString, HistoUnfolding*, std::less<TString>,
> std::allocator<std::pair<TString const, HistoUnfolding*> > >
> aggrbackgroundMC;
> Python Exception <class 'gdb.error'> No type named HistoUnfolding*.:
> std::vector<HistoUnfolding*, std::allocator<HistoUnfolding*> >
> _vbackgroundhistos;
> Python Exception <class 'gdb.error'> No type named SampleDescriptor*.:
> std::vector<SampleDescriptor*, std::allocator<SampleDescriptor*> >
> _expsyssamples;
> std::vector<SampleDescriptor*, std::allocator<SampleDescriptor*> >
> _markedsyssamples;
> HistoUnfoldingTH2 *totalbackground;
> char _signal_title[64];
> ...
>
> How to proceed from this point?
> Viesturs
I tried this simple code, and everything works as expected:
---
class Outer
{
class Inner
{
int foo = 2;
public:
int getFoo() {
return foo;
}
};
public:
Inner getBar()
{
return Inner();
}
};
int main()
{
Outer o;
return o.getBar().getFoo();
}
---
(gdb) p o.getBar().getFoo()
$2 = 2
(gdb) ptype Outer::Inner
type = class Outer::Inner {
private:
int foo;
public:
int getFoo(void);
}
To continue investigating, I would need a minimal reproducer, because at
this point I can only do some very wild guessing.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB support: Couldn't find method
2018-08-04 11:48 GDB support: Couldn't find method Viesturs Veckalns
2018-08-08 0:27 ` Simon Marchi
@ 2018-08-20 15:13 ` Pedro Alves
1 sibling, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2018-08-20 15:13 UTC (permalink / raw)
To: Viesturs Veckalns, gdb
On 08/04/2018 12:48 PM, Viesturs Veckalns wrote:
> Hello!
> I compile a binary by linking a library:
>
> -L${LIBDIR}/lib -lCompoundHisto
>
> In the debug session the library is listed under
>
> info sharedlibrary
>
> Additionally, I requested to read symbols from the relevant source files by
>
> set debug-file-directory ${LIBDIR}/interface
> set debug-file-directory ${LIBDIR}/src
Note that "set debug-file-directory" is used to point GDB at
debug symbol files, not source files. For the latter, you'd use
the "directory" command.
>
> Nevertheless, I encounter the following problem:
>
> p GetLevel(resultcode) -> GetHU(mo)
> Couldn't find method CompoundHistoUnfolding::Level::GetHU
>
> The methods are described in the source to build libCompoundHisto.so
>
> What is wrong?
>
> My gdb version is 7.11.
Since it works for Simon downthread, and absent a more complete
reproducer, I'd suggest trying a newer GDB version. 7.11 is a few
releases behind by now.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-20 15:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-04 11:48 GDB support: Couldn't find method Viesturs Veckalns
2018-08-08 0:27 ` Simon Marchi
2018-08-08 11:15 ` Viesturs Veckalns
2018-08-20 15:03 ` Simon Marchi
2018-08-20 15:13 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox