<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 3, 2021 at 9:50 AM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Mar 3, 2021 at 12:08 AM Richi Dubey <<a href="mailto:richidubey@gmail.com" target="_blank">richidubey@gmail.com</a>> wrote:<br>
><br>
> What's the element written after the free? I set a watch at the exact block location, but it doesn't work:<br>
><br>
> Hardware watchpoint 7: *0x202ba8<br>
> (gdb) watch *0x206fec<br>
> Hardware watchpoint 8: *0x206fec<br>
That's just the first byte in the block. If you can figure out which<br>
bytes/words in the block get accessed that would help you.<br></blockquote><div><br></div><div>What about watch *(unsigned int)*
0x202ba8?</div><div><br></div><div>Won't that look at more bytes? </div><div><br></div><div>In case you do need to look at more bytes in the fence...</div><div>breaking at _Terminate and doing a back trace will give <br></div><div>you the exact line the error is raised from. You can then set a </div><div>breakpoint at that on the next line and look at local variables.</div><div>The corruption may be in the fence somewhere beyond the </div><div>first 32-bits.</div><div><br></div><div>Sometimes it is easy to binary search for an issue like this</div><div>on a simulator. But with a watchpoint, you should be able to</div><div>determine the precise word which is corrupted in the fence</div><div>and break on that write.</div><div><br></div><div>--joel</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> (gdb) c<br>
> Continuing.<br>
><br>
> Thread 1 hit Breakpoint 6, Init (argument=2107944) at /home/richi/quick-start/LatestStrong/src/rtems/c/src/../../testsuites/sptests/sp02/init.c:26<br>
> 26 TEST_BEGIN();<br>
> (gdb)<br>
> Continuing.<br>
><br>
> Thread 1 hit Breakpoint 5, _Terminate (the_source=RTEMS_FATAL_SOURCE_HEAP, the_error=2125180) at /home/richi/quick-start/LatestStrong/src/rtems/c/src/../../cpukit/score/src/interr.c:38<br>
> 38 _User_extensions_Fatal( the_source, the_error );<br>
> (gdb)<br>
> Continuing.<br>
><br>
> Thread 1 hit Breakpoint 4, bsp_reset () at /home/richi/quick-start/LatestStrong/src/rtems/c/src/lib/libbsp/arm/realview-pbx-a9/../../../../../../bsps/arm/realview-pbx-a9/start/bspreset.c:19<br>
> 19 volatile uint32_t *sys_lock = (volatile uint32_t *) 0x10000020;<br>
> (gdb)<br>
><br>
> On Wed, Mar 3, 2021 at 12:31 PM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a>> wrote:<br>
>><br>
>> On 02/03/2021 05:44, Richi Dubey wrote:<br>
>><br>
>> ><br>
>> > (gdb) p *(Heap_Error_context*)(0x00206d7c)<br>
>> > $5 = {<br>
>> > heap = 0x202ba8 <_Workspace_Area>,<br>
>> > block = 0x206fec,<br>
>> > reason = HEAP_ERROR_FREE_PATTERN<br>
>> > }<br>
>><br>
>> If it is always the same address, then you can set a watch point to an<br>
>> element which is written after the free to catch the function which<br>
>> writes into this area.<br>
>><br>
>> --<br>
>> embedded brains GmbH<br>
>> Herr Sebastian HUBER<br>
>> Dornierstr. 4<br>
>> 82178 Puchheim<br>
>> Germany<br>
>> email: <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a><br>
>> phone: +49-89-18 94 741 - 16<br>
>> fax: +49-89-18 94 741 - 08<br>
>><br>
>> Registergericht: Amtsgericht München<br>
>> Registernummer: HRB 157899<br>
>> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler<br>
>> Unsere Datenschutzerklärung finden Sie hier:<br>
>> <a href="https://embedded-brains.de/datenschutzerklaerung/" rel="noreferrer" target="_blank">https://embedded-brains.de/datenschutzerklaerung/</a><br>
>><br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></blockquote></div></div>