|
From: Duncan S. <bal...@fr...> - 2010-08-05 20:13:36
|
I got this report from valgrind-3.5.0-Debian: ==1787== Thread 27: ==1787== Invalid write of size 1 ==1787== at 0x81E83D1: thin_quotes__collapse (order_book_updates.ads:19) ==1787== Address 0x6092bdc is on thread 27's stack I've seen reports like this before about a thread writing to a different thread's stack, but here it's the thread writing to its own stack. Does anyone understand what valgrind is trying to say here? Thanks for your help, Duncan. |
|
From: John R. <jr...@bi...> - 2010-08-05 21:11:52
|
> ==1787== Thread 27: > ==1787== Invalid write of size 1 > ==1787== at 0x81E83D1: thin_quotes__collapse (order_book_updates.ads:19) > ==1787== Address 0x6092bdc is on thread 27's stack > > I've seen reports like this before about a thread writing to a different > thread's stack, but here it's the thread writing to its own stack. Except for when the stack frame [that corresponds to a dynamic invocation of a subroutine] is being created, it is illegal to write to the saved return address or to the registers that are saved automatically according to the subroutine calling convention (the saved frame pointer, etc.). These areas are "write once [at entry]" and "read once [at return]", except possibly for reading to generate tracebacks during error handling, etc. Also, on a thread stack there are some fixed areas that have similar restrictions: writable only at creation of the thread. -- |
|
From: Tom H. <to...@co...> - 2010-08-05 21:34:22
|
On 05/08/10 22:11, John Reiser wrote: >> ==1787== Thread 27: >> ==1787== Invalid write of size 1 >> ==1787== at 0x81E83D1: thin_quotes__collapse (order_book_updates.ads:19) >> ==1787== Address 0x6092bdc is on thread 27's stack >> >> I've seen reports like this before about a thread writing to a different >> thread's stack, but here it's the thread writing to its own stack. > > Except for when the stack frame [that corresponds to a dynamic invocation > of a subroutine] is being created, it is illegal to write to the saved return > address or to the registers that are saved automatically according to the > subroutine calling convention (the saved frame pointer, etc.). These areas > are "write once [at entry]" and "read once [at return]", except possibly for > reading to generate tracebacks during error handling, etc. > > Also, on a thread stack there are some fixed areas that have similar > restrictions: writable only at creation of the thread. The most likely answer is probably that the program is writing to an address below the current stack pointer - ie to something that has already been popped off the stack. One common cause would be returning a pointer to data which is on the stack to a calling routine. Tom -- Tom Hughes (to...@co...) http://compton.nu/ |
|
From: John R. <jr...@bi...> - 2010-08-05 22:10:41
|
> The most likely answer is probably that the program is writing to an > address below the current stack pointer - ie to something that has > already been popped off the stack. If so, then the words "on the wrong side of the stack pointer" (or similar) should appear in the error message. -- |