Re: How to catch GDB crash

Aleksandar Ristovski
2008-06-23T16:57:19Z

Dmitry Smirnov wrote:
> Hi,
>
> I've encountered the very annoying problem with GDB. While debugging, it crashes for some reason and I cannot catch this moment. I have a possibility to attach to the running process with another GDB, but it does not help. Perhaps, there is some way to catch some system exception or something similar?
>
> I'm using a litle bit complex setup, so there is no much freedom (at least I cannot simplify the situation). First, I'm debugging from Eclipse (and it looks this crash happens only while running from Eclipse, I've tried from commad line - there is no crash). The debugger I'm using is cross-compiled arm-elf-gdb. It is compiled on windows (i686) platform:
> GNU gdb (GDB) 6.8.50.20080620
> ...
> This GDB was configured as "--host=i686-pc-cygwin --target=arm-elf".
>
> I doubt this can be linked to GDB version. I recall I've seen this crash earlier with arm-elf-gdb 6.5 from GNUARM. I was just skipped this crash somehow but now I cannot continue my job.
>

Hello, I am working on a problem that might be related (although gdb version I am using is 6.7).

Could you try with this sample code? (from cmd line, set a breakpoint in printSimple and once the breakpoint is hit do 'print p' and see if the output makes sense).

Thanks,

Aleksandar Ristovski
QNX Software Systems

#include <stdlib.h>
#include <stdio.h>

struct participant {
char name[15];
char country[15];
float score;
int age;
};

void printSimpleP(struct participant *p)
{
printf("Name: %s, Country: %s, Score: %f, Age: %d\n",
p->name, p->country, p->score, p->age);
}

void printSimple(struct participant p)
{
printSimpleP(&p);
}

int main(int argc, char *argv[]) {
struct participant p = { "Foo", "Bar", 1.2, 45 };
printSimple(p);
return 0;
}