This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: gmtime_r hanging
On 20/12/2011, at 9:31, Daniel O'Connor wrote:
> On 19/12/2011, at 23:51, Joel Sherrill wrote:
>> There is always the possibility of a real bug but seeing a 128 byte buffer on the stack makes me wonder if you have blown the stack.
>>
>> What is the stack address range? Check the stack pointer. You can always fill the stack memory with a pattern and see how much is written to.
>
> Ahh good thinking, but it doesn't appear to be the case :(
>
> I tried using malloc as well as shrinking it to 40 bytes with no change.
>
> I tried the following code (directly in main)..
>
> i = 1;
> sprintf(buf, "%d\r\n", i);
> printf("bar %d\r\n", i);
> a = 10000;
> b = 500;
> i = a / b;
> puts(buf);
> printf("foo %d\r\n", i);
>
> and the printf jumps to 0, if i remove i = a / b; then it doesn't.. Colour me confused :(
I stepi'd and found..
1436 *--cp = to_char (_uquad % 10);
(gdb)
0x080070dc 1436 *--cp = to_char (_uquad % 10);
(gdb)
0x080070de 1436 *--cp = to_char (_uquad % 10);
disassembly shows..
0x080070d8 <+3544>: ldr r5, [sp, #64] ; 0x40
0x080070da <+3546>: adds r0, r6, #0
0x080070dc <+3548>: movs r1, #10
0x080070de <+3550>: blx 0x800c538 <__aeabi_uidivmod>
0x080070e2 <+3554>: subs r5, #1
0x080070e4 <+3556>: adds r1, #48 ; 0x30
> --
> Daniel O'Connor software and network engineer
> for Genesis Software - http://www.gsoft.com.au
> "The nice thing about standards is that there
> are so many of them to choose from."
> -- Andrew Tanenbaum
> GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
>
>
>
>
>
>
>
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C