This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: "too few arguments in function call"
On Tuesday 05 August 2008 10:09:33 Andreas Schwab wrote:
> André Pönitz <apoenitz@trolltech.com> writes:
>
> > However, if I do something like gdb ./myapp-with-all-plugins I get
> >
> > (gdb) p "xxx"
> > too few arguments in function call
>
> When gdb processes a string in an expression it allocates space in the
> inferior by calling malloc and copying the string contents into this
> space. Apparently gdb gets confused when it looks up the address of the
> malloc function.
>
> > When this message is issued in infcall.c, nargs is always 1, and
> > TYPE_NFIELDS (ftype) is 2, independently of the arity of the called
> > function, so it really seems to involve the 'string literal conversion'
> > (or parsing, or whatever gdb does at that point).
>
> What does `info function malloc' show?
Bingo! ;-)
There are a few hundred lines, but the culprit seems to be a
class foo { ... static foo *malloc(int, int, int, foo*); }
function. If I rename this, the problem goes away.
Unfortunately, that's something that cannot be changed
in the production code for the next few year ;-}
Is there a way to convince gdb not to try to use functions
with unsuitable arity if there's a suitable one present?
In any case: Thanks a lot, that was a big step forward!
Regards,
André