public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* C++, "too few arguments in function call" error?
@ 2006-03-17  7:07 rob
  2006-03-17 11:37 ` Dave Korn
  0 siblings, 1 reply; 6+ messages in thread
From: rob @ 2006-03-17  7:07 UTC (permalink / raw)
  To: gdb

Hi all,

I'm using GDB 6.1 on Mac OS X to debug a C++ program.  Occasionally,  
when I try to call an object's member function I get this error:

(gdb) p set1.begin()
too few arguments in function call

In this case "set1" is an STL std::set, but I get the same message  
sometimes with my own classes.  Has anyone seen this before, or know  
what's going on, or a way around it?

thanks,

Rob


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

* RE: C++, "too few arguments in function call" error?
  2006-03-17  7:07 C++, "too few arguments in function call" error? rob
@ 2006-03-17 11:37 ` Dave Korn
  2006-03-17 18:36   ` Daniel Jacobowitz
  2006-03-17 19:06   ` rob
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Korn @ 2006-03-17 11:37 UTC (permalink / raw)
  To: rob, gdb

On 17 March 2006 03:57, rob@encodia.biz wrote:

> Hi all,
> 
> I'm using GDB 6.1 on Mac OS X to debug a C++ program.  Occasionally,
> when I try to call an object's member function I get this error:
> 
> (gdb) p set1.begin()
> too few arguments in function call
> 
> In this case "set1" is an STL std::set, but I get the same message
> sometimes with my own classes.  Has anyone seen this before, or know
> what's going on, or a way around it?

  This is a total shot in the dark, but maybe something's gone wrong and it's
expecting you to pass the this pointer as an explicit first argument rather
than an implicit one?


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

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

* Re: C++, "too few arguments in function call" error?
  2006-03-17 11:37 ` Dave Korn
@ 2006-03-17 18:36   ` Daniel Jacobowitz
  2006-03-17 22:02     ` rob
  2006-03-17 19:06   ` rob
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-03-17 18:36 UTC (permalink / raw)
  To: Dave Korn; +Cc: rob, gdb

On Fri, Mar 17, 2006 at 11:03:11AM -0000, Dave Korn wrote:
> On 17 March 2006 03:57, rob@encodia.biz wrote:
> 
> > Hi all,
> > 
> > I'm using GDB 6.1 on Mac OS X to debug a C++ program.  Occasionally,
> > when I try to call an object's member function I get this error:
> > 
> > (gdb) p set1.begin()
> > too few arguments in function call
> > 
> > In this case "set1" is an STL std::set, but I get the same message
> > sometimes with my own classes.  Has anyone seen this before, or know
> > what's going on, or a way around it?
> 
>   This is a total shot in the dark, but maybe something's gone wrong and it's
> expecting you to pass the this pointer as an explicit first argument rather
> than an implicit one?

That's pretty likely.  Rob, we probably can't help you with problems
involving C++ and MacOS X; Apple's highly patched GDB uses stabs, not
DWARF-2, and therefore represents debug information for methods very
differently.

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: C++, "too few arguments in function call" error?
  2006-03-17 11:37 ` Dave Korn
  2006-03-17 18:36   ` Daniel Jacobowitz
@ 2006-03-17 19:06   ` rob
  2006-03-18 10:18     ` Dave Korn
  1 sibling, 1 reply; 6+ messages in thread
From: rob @ 2006-03-17 19:06 UTC (permalink / raw)
  To: gdb


On Mar 17, 2006, at 6:03 AM, Dave Korn wrote:
> On 17 March 2006 03:57, rob@encodia.biz wrote:
>>
>> (gdb) p set1.begin()
>> too few arguments in function call
>
>   This is a total shot in the dark, but maybe something's gone  
> wrong and it's
> expecting you to pass the this pointer as an explicit first  
> argument rather
> than an implicit one?

That does work sometimes.  But if the class is a template, or if the  
method is overloaded, I can't do it, or I have to type way too much,  
or I get this <incomplete type> error.   Examples...

(gdb) p set1.begin(&set1)
Cannot resolve method  
set<xml::XmlNode*,std::less<xml::XmlNode*>,std::allocator<xml::XmlNode*> 
  >::begin to any overloaded instance
(gdb) p set<xml::XmlNode*, std::less<xml::XmlNode*>,  
std::allocator<xml::XmlNode*> >::begin(&set1)
$1 = {
   _M_node = 0x3008c0
}

That works, but it's horrible.

(gdb) p set<xml::XmlNode*, std::less<xml::XmlNode*>,  
std::allocator<xml::XmlNode*> >::size(&set1)
$8 = <incomplete type>
(gdb) p (int)(set<xml::XmlNode*, std::less<xml::XmlNode*>,  
std::allocator<xml::XmlNode*> >::size(&set1))
Invalid cast.

I can't get the size(), bu it's similar to begin() -- both are  
inline, both return types that are typedef'd in the same place.


(gdb) p vector<xml::Step*, std::allocator<xml::Step*> >::begin(&steps)
non-unique member `begin' requires type instantiation

?

Rob

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

* Re: C++, "too few arguments in function call" error?
  2006-03-17 18:36   ` Daniel Jacobowitz
@ 2006-03-17 22:02     ` rob
  0 siblings, 0 replies; 6+ messages in thread
From: rob @ 2006-03-17 22:02 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Dave Korn, gdb


On Mar 17, 2006, at 12:43 PM, Daniel Jacobowitz wrote:
>
> That's pretty likely.  Rob, we probably can't help you with problems
> involving C++ and MacOS X; Apple's highly patched GDB uses stabs, not
> DWARF-2, and therefore represents debug information for methods very
> differently.

Ah... I was wondering about the Mac OS effect.  Thanks for the info.   
I'll try asking on an Apple mailing list, or maybe just move back to  
Linux for compiling and debugging.

Rob


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

* RE: C++, "too few arguments in function call" error?
  2006-03-17 19:06   ` rob
@ 2006-03-18 10:18     ` Dave Korn
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Korn @ 2006-03-18 10:18 UTC (permalink / raw)
  To: rob, gdb

On 17 March 2006 18:28, rob@encodia.biz wrote:


> That does work sometimes.  But if the class is a template, or if the
> method is overloaded, I can't do it, or I have to type way too much,

  You do know about gdb doing tab-completion, yes?  It doesn't always help but
I just thought I'd ask...

> (gdb) p set<xml::XmlNode*, std::less<xml::XmlNode*>,
> std::allocator<xml::XmlNode*> >::begin(&set1)
> $1 = {
>    _M_node = 0x3008c0
> }
> 
> That works, but it's horrible.

  Less so with completion.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

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

end of thread, other threads:[~2006-03-17 19:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-17  7:07 C++, "too few arguments in function call" error? rob
2006-03-17 11:37 ` Dave Korn
2006-03-17 18:36   ` Daniel Jacobowitz
2006-03-17 22:02     ` rob
2006-03-17 19:06   ` rob
2006-03-18 10:18     ` Dave Korn

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).