This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
"too few arguments in function call"
- From: André Pönitz <apoenitz at trolltech dot com>
- To: gdb at sources dot redhat dot com
- Date: Tue, 5 Aug 2008 09:53:41 +0200
- Subject: "too few arguments in function call"
Hi all.
I have a problem with gdb that I can't explain, and that I currently
can't work around. I hope someone can give me a hint on how I
could proceed debugging it.
Unfortunately, the environment is too complex to produce the
situation from scratch, so let me try to explain the obsevations:
I have a medium sized application that dynamically loads a dozen plugins.
When I do gdb ./myapp-core followed by
set break pending on
b coreplugin.cpp:28 (that's the init function of one of the plugins)
r
p "xxx"
I get the expected result
(gdb) p "xxx"
$1 = "x
However, if I do something like gdb ./myapp-with-all-plugins I get
(gdb) p "xxx"
too few arguments in function call
This happens with gcc 6.8, gcc 6.5 and gcc 6.3 (x86_64-linux-gnu).
I tried to find a situation where minimal changes to my application
switches between the two observed behaviours and found a situation
where the list of used plugins were identical, and only for one of the
plugins were differences, and that difference was a single additionally
referenced weak symbol in code.
The problem remains the same indepentendly of whether I use "-i mi"
or not. It also concerns _all_ commandlines involving string literals, so
if I have e.g. a 'void foo(char *) {}' in my application and do a
'call foo("xxx")' in gdb, I'd get 'too few arguments in function call',
if I do 'call foo(0)', I don't get that message.
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).
I'd glad if anyone had an idea why such behaviour can occur and
what would be needed to avoid it.
André