RE: [PATCH] Fix that different function breakpoints are set at same pc address (PR gdb/12703)

Terry Guo
2011-06-29T07:00:35Z

Hi,

Here is my case. As for stack backtrace, I wonder whether it works for the function that only contains one single instruction and function that doesn't even has a valid prologue. I also saw that current prologue analyzer cannot handle all cases, so I try to avoid this in a more general way.

unsigned long _etext;
unsigned long _data;
unsigned long _edata;
register unsigned long guard asm("r5");

void bar (void);
void test (void) __attribute__((naked));

void
foo (void)
{
while(1)
{
}
} /* End of function foo. */

void
test (void)
{
guard = 10;
}

void
bar (void)
{
unsigned long *pulSrc, *pulDest;

pulSrc = &_etext;

for (pulDest = &_data; pulDest < &_edata;)
{
*pulDest++ = *pulSrc++;
}

if (*pulSrc > guard)
guard = 0;
else
guard = 1;
}

void
main (int argc, char **argv)
{
test ();
}