<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Finding a call stack programmatically (unwind?).</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115780/finding-a-call-stack-programmatically-unwind</link><description>I am attempting to write a routine that monitors the heap in order to track down a memory leak. I&amp;#39;ve seen similar tools on other platforms and found them quite helpful. To make this even more effective, I want to record the caller to malloc() that made</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Oct 2024 21:07:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115780/finding-a-call-stack-programmatically-unwind" /><item><title>RE: Finding a call stack programmatically (unwind?).</title><link>https://devzone.nordicsemi.com/thread/508251?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 21:07:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15b36734-30ec-4a6b-80af-a213231788b2</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Most useful if you can get it working; last time I looked I saw this with a couple of git links at the end:&amp;nbsp;&lt;a href="https://stackoverflow.com/questions/78760640/unwinding-stack-on-cortex-m-with-freertos-handling-interrupts-and-stopping-cond"&gt;unwinding-stack-on-cortex-m-with-freertos&lt;/a&gt;&amp;nbsp;also&amp;nbsp;&lt;a href="https://github.com/armink/CmBacktrace"&gt;CmBacktrace&lt;/a&gt;&amp;nbsp;which has an IAR example&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Finding a call stack programmatically (unwind?).</title><link>https://devzone.nordicsemi.com/thread/508246?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 19:02:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9e89656-aadd-485c-bd28-65a3198dca6e</guid><dc:creator>wdtj</dc:creator><description>&lt;p&gt;To reiterate: I am not interested in the malloc itself, I am just referencing that for context.&amp;nbsp; What I am interested in is how to access the caller stack.&amp;nbsp; This involves getting access to the sp and/or lr registers and walking through the stack.&amp;nbsp; Is the stack defined by IAR or ARM or Nordic.&amp;nbsp; Call stack unwinding is a critical piece of debugging, either live through a IDE or in postmortem as in this case.&lt;br /&gt;&lt;br /&gt;I am in touch with IAR, and their as confused by this as you folks.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Finding a call stack programmatically (unwind?).</title><link>https://devzone.nordicsemi.com/thread/507860?ContentTypeID=1</link><pubDate>Fri, 25 Oct 2024 07:51:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f28efe17-4ab4-47e9-9dac-98c9cfc677f5</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;*alloc() functions is provded by the libc, which is provided by IAR in your case.&lt;/p&gt;
&lt;p&gt;I would recommend that you ask IAR if they have a heap allocation/profiling functionality available.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Finding a call stack programmatically (unwind?).</title><link>https://devzone.nordicsemi.com/thread/507802?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2024 15:34:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a23d5bb-4dbd-41ec-8c93-c3cbb49ef804</guid><dc:creator>wdtj</dc:creator><description>&lt;p&gt;Thanks, but that&amp;#39;s not what I asked.&amp;nbsp; I am aware that IAR (and other IDEs) have the ability to generate a call stack after stopping the processor.&amp;nbsp; What I was after is getting the program itself to tell me who called this function/method.&amp;nbsp; This allows me to log these callers and identify them long after the event has happened.&amp;nbsp; In this case, when the malloc is called, I would log the event along with the caller&amp;#39;s location.&amp;nbsp; After detecting that this buffer was not returned, I can then look up what the buffer was requested for, and thus determine why it was not returned to the heap.&amp;nbsp; Other environments, like Linux, Unix, and Windows have this capability.&amp;nbsp; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Finding a call stack programmatically (unwind?).</title><link>https://devzone.nordicsemi.com/thread/507783?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2024 14:05:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80d20eee-eb94-4adf-83ef-ac996071c517</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;malloc is a part of the compiler suite libc.&lt;/p&gt;
&lt;p&gt;These issues are usually tracked with entering debug mode and having a plugin to make your IDE rtos-aware. I am not sure what IAR offers, but it seems that they have something for freertos:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.iar.com/products/integrations/"&gt;https://www.iar.com/products/integrations/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>