<?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>MCUXpresso IDE中的主题 How to Debug and detect (optimized C++) code</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/How-to-Debug-and-detect-optimized-C-code/m-p/1196215#M6456</link>
    <description>&lt;P&gt;I ported a working project to MCUXpresso but not everything seems to work as it should do.&lt;BR /&gt;I started to place some breakpoints on points that shouldn't happen and bumped into the following situation:&lt;/P&gt;&lt;P&gt;I have a small piece of code that turns on/off a lamp when there is a connection.&lt;BR /&gt;The lamp sometimes went on without a reason, so i ended up placing 3 breakpoints.(Picture A, IDE breakpoints 3x)&lt;BR /&gt;1) on the if statement, 2) the "true" result and 3) the "false" result&lt;/P&gt;&lt;P&gt;when stepping through this piece of code ALL 3 breakpoints are(/seem to) executed&lt;BR /&gt;looking at the ASM code shows the reason i think. (Picture B, IDE breakpoints ASM 3x)&lt;BR /&gt;Code is optimized? merging the code in a way breakpoints make no sense.&lt;BR /&gt;(i original only wanted a breakpoint on one of the results but it always stopped so i ended up placeing 3 to see why)&lt;/P&gt;&lt;P&gt;Question:&lt;BR /&gt;It seems that only one of the C++ statements is executed but how can i place a real breakpoint in this kinds of situations without having to look at the asm code?&lt;BR /&gt;I already had another situation (reading a switch) which never got trapped by an other breakpoint before i placed some __nops around it. (didn't look at asm code)&lt;/P&gt;&lt;P&gt;This kind of behavior makes debugging hard to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Dec 2020 12:27:21 GMT</pubDate>
    <dc:creator>bwinter</dc:creator>
    <dc:date>2020-12-09T12:27:21Z</dc:date>
    <item>
      <title>How to Debug and detect (optimized C++) code</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/How-to-Debug-and-detect-optimized-C-code/m-p/1196215#M6456</link>
      <description>&lt;P&gt;I ported a working project to MCUXpresso but not everything seems to work as it should do.&lt;BR /&gt;I started to place some breakpoints on points that shouldn't happen and bumped into the following situation:&lt;/P&gt;&lt;P&gt;I have a small piece of code that turns on/off a lamp when there is a connection.&lt;BR /&gt;The lamp sometimes went on without a reason, so i ended up placing 3 breakpoints.(Picture A, IDE breakpoints 3x)&lt;BR /&gt;1) on the if statement, 2) the "true" result and 3) the "false" result&lt;/P&gt;&lt;P&gt;when stepping through this piece of code ALL 3 breakpoints are(/seem to) executed&lt;BR /&gt;looking at the ASM code shows the reason i think. (Picture B, IDE breakpoints ASM 3x)&lt;BR /&gt;Code is optimized? merging the code in a way breakpoints make no sense.&lt;BR /&gt;(i original only wanted a breakpoint on one of the results but it always stopped so i ended up placeing 3 to see why)&lt;/P&gt;&lt;P&gt;Question:&lt;BR /&gt;It seems that only one of the C++ statements is executed but how can i place a real breakpoint in this kinds of situations without having to look at the asm code?&lt;BR /&gt;I already had another situation (reading a switch) which never got trapped by an other breakpoint before i placed some __nops around it. (didn't look at asm code)&lt;/P&gt;&lt;P&gt;This kind of behavior makes debugging hard to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 12:27:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/How-to-Debug-and-detect-optimized-C-code/m-p/1196215#M6456</guid>
      <dc:creator>bwinter</dc:creator>
      <dc:date>2020-12-09T12:27:21Z</dc:date>
    </item>
  </channel>
</rss>

