<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Function arguments getting corrupted during debug in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Function-arguments-getting-corrupted-during-debug/m-p/179767#M4080</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is not easy to determine the cause of the problem.&lt;BR /&gt;The better way will be to log it directly in the Technical support system.&lt;BR /&gt;Please use Freescale on line support web page.&lt;BR /&gt;&amp;nbsp; - Go to following URL: &lt;A href="http://www.freescale.com/TechSupport" rel="nofollow" target="_blank"&gt;http://www.freescale.com/TechSupport&lt;/A&gt;&lt;BR /&gt;&amp;nbsp; - Click on Submit a Service Request. You will come to a login page.&lt;BR /&gt;&amp;nbsp; - You can submit your request through the web from there.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can you please provide us your example reproducing the issue ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pascal&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Aug 2008 19:20:57 GMT</pubDate>
    <dc:creator>trytohelp</dc:creator>
    <dc:date>2008-08-22T19:20:57Z</dc:date>
    <item>
      <title>Function arguments getting corrupted during debug</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Function-arguments-getting-corrupted-during-debug/m-p/179766#M4079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm debugging on a DSP56858 with CW 8.2.&amp;nbsp; My application includes an rtos.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've noticed that function arguments become corrupted sometimes.&amp;nbsp; For example, I set 2 breakpts in the code below and hit Run. &amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CW stops at breakpt #1.&amp;nbsp; I see that arg1=0 and arg2=3. &amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I stepover myfunc(). &amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CW stops at breakpt #2.&amp;nbsp; arg1=6 and arg2=788.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Stepover at the assert indicates that arg1 and arg2 are out of range.&amp;nbsp; arg1 should be 0 and arg2 should be 3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void caller(char arg1, char arg2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; myfunc(arg1, arg2);&amp;nbsp;&amp;nbsp; // &amp;lt;--- set breakpt #1 here, arg1=0 and arg2=3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; // stepover&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void myfunc(char arg1, char arg2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; ASSERT (arg1 &amp;lt; 5);&amp;nbsp;&amp;nbsp; // &amp;lt;--- set breakpt #2.&amp;nbsp; arg1=6 and arg2=788.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; ASSERT (arg2 &amp;lt; 10);&amp;nbsp; // stepover causes assert to report the error condition&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I viewed the code in disassembly and noticed that arg1 and arg2 are placed in the Y0 and Y1 registers.&amp;nbsp; Before mfunc() is called, Y0 and Y1 are correct.&amp;nbsp; When the code executes to breakpt #2, Y0 and Y1 are 6 and 788 respectively.&amp;nbsp; So it looks like Y0 and Y1 got overwritten.&amp;nbsp; Single-stepping is disassembly did not show that Y0 and Y1 were corrupted.&amp;nbsp; Furthermore, if I ran the code without breakpts, the asserts did not report any errors with arg1 and arg2, so it seems like it is behaving as expected.&amp;nbsp; I suspect that the rtos is somehow interfering with the debugger since the code was ported from a project that does not use the rtos.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I could be wrong, and perhaps I need to configure the debugger differently.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, if anyone has experienced something similar and knows of a work-around/fix, please let me know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-win&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2008 02:41:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Function-arguments-getting-corrupted-during-debug/m-p/179766#M4079</guid>
      <dc:creator>windam</dc:creator>
      <dc:date>2008-08-14T02:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Function arguments getting corrupted during debug</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Function-arguments-getting-corrupted-during-debug/m-p/179767#M4080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is not easy to determine the cause of the problem.&lt;BR /&gt;The better way will be to log it directly in the Technical support system.&lt;BR /&gt;Please use Freescale on line support web page.&lt;BR /&gt;&amp;nbsp; - Go to following URL: &lt;A href="http://www.freescale.com/TechSupport" rel="nofollow" target="_blank"&gt;http://www.freescale.com/TechSupport&lt;/A&gt;&lt;BR /&gt;&amp;nbsp; - Click on Submit a Service Request. You will come to a login page.&lt;BR /&gt;&amp;nbsp; - You can submit your request through the web from there.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can you please provide us your example reproducing the issue ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pascal&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2008 19:20:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Function-arguments-getting-corrupted-during-debug/m-p/179767#M4080</guid>
      <dc:creator>trytohelp</dc:creator>
      <dc:date>2008-08-22T19:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Function arguments getting corrupted during debug</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Function-arguments-getting-corrupted-during-debug/m-p/179768#M4081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Here is what I would check:&lt;BR /&gt;make sure that the function caller() sees a prototype for the function myfunc(). From the code piece this looks like an implicit parameter declaration (the compiler does not see a prototype of the function) If so, then the compiler has to assume that the function is defined with actual arguments, returning int.&lt;BR /&gt;&lt;BR /&gt;Make sure you include myfunc() prototype in a header file or declare it before using it.&lt;BR /&gt;&lt;BR /&gt;You may check all the compiler warnings (and check if you have not disabled them).&lt;BR /&gt;&lt;BR /&gt;The other thing is: check if you have enough RAM reserved for you stack.&lt;BR /&gt;&lt;BR /&gt;BK&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2008 19:55:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Function-arguments-getting-corrupted-during-debug/m-p/179768#M4081</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2008-08-22T19:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Function arguments getting corrupted during debug</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Function-arguments-getting-corrupted-during-debug/m-p/179769#M4082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I checked all your recommendations.&amp;nbsp; It turns out that registers weren't getting saved properly.&amp;nbsp; The interrupt handlers had:&lt;BR /&gt;#pragma interrupt alignsp&lt;BR /&gt;void RxSCI0_Interrupt ( void )&lt;BR /&gt;&lt;BR /&gt;The above is probably ok without an RTOS.&amp;nbsp; Since we're multitasking, adding saveall seems to prevent corruption:&lt;BR /&gt;#pragma interrupt alignsp saveall&lt;BR /&gt;void RxSCI0_Interrupt ( void )&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;-win&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 01:20:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Function-arguments-getting-corrupted-during-debug/m-p/179769#M4082</guid>
      <dc:creator>windam</dc:creator>
      <dc:date>2008-09-04T01:20:28Z</dc:date>
    </item>
  </channel>
</rss>

