Brandon Sneed wrote:
> On Jun 17, 2007, at 12:01 PM, Pedro Alves wrote:
>> Brandon Sneed wrote:
>>> the C hello world sample in my original message doesn't have any
>>> ctors, so i'm guessing its something else.
>> The __main call is always inserted, no matter if you have global
>> or not. The compiler doesn't know what you will link the object too.
>> Even when main is compiled in a C object, the __main is emitted to
>> the linking of C++ objects/libs with C code.
> would this affect the values of argc/argv not being valid? gdb 6.6
> no longer does the odd stepping behavior, but the parameters for main
> as they are passed in are unusable.
I've seen this happen before, but after a "next" the parameters would
be OK. Isn't that what happens? That is, when the program breaks at
main, the args are garbage looking, but after a few (one) steps/nexts
they show as excepted? Try printing them using printf, to
understand if it is gdb that isn't seeing them properly, or if
they are really garbage. Eg, run this under gdb, and step through
the printf's and compare to what gdb prints with print/display.
int main(int argc, char **argv)
printf ("argc = %d\n");
for (int i = 0; i < argc; i++)
printf ("argv[%d] = %s\n", i, argv[i]);
Also, if the problem persists after stepping, if possible, try this
with gdb from cvs.