<?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>Call function from gdb at breakpoint?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24081/call-function-from-gdb-at-breakpoint</link><description>Hi, 
 Is it possible to call an arbitrary function at a breakpoint in gdb on the nRF52? I know you can with normal gdb, but I haven&amp;#39;t been able to make it work with the cross ARM version. Thanks. 
 SDK13
PCA10040/nRF52832
GNU gdb (GNU Tools for ARM</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Aug 2017 09:01:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24081/call-function-from-gdb-at-breakpoint" /><item><title>RE: Call function from gdb at breakpoint?</title><link>https://devzone.nordicsemi.com/thread/94825?ContentTypeID=1</link><pubDate>Fri, 04 Aug 2017 09:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b899c026-8a94-44d1-8235-bb1c8bf107c5</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I just tested this with gcc-arm-none-eabi-6_2-2016q4 on the blinky example.
I added this function which blinks with 1 sec delay instead of 500 ms:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void test_function(void)
{
    for (int i = 0; i &amp;lt; LEDS_NUMBER; i++)
    {
        bsp_board_led_invert(i);
        nrf_delay_ms(1000);
    }    
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Remember to run this function once before entering &lt;code&gt;while(1)&lt;/code&gt; loop to ensure that gcc does not dump it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;arm-none-eabi-gdb _build/*.out 
(gdb) target remote :2331 
(gdb) load 
(gdb) mon reset 
(gdb) c 
&amp;lt;break somewhere in your code once the 500 ms routine starts, using CTRL+C&amp;gt; 
(gdb) call test_function()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is very important that you add the parentheses when calling &amp;quot;call func()&amp;quot;. Once it is finished calling the function, it will go back to a halted state.&lt;/p&gt;
&lt;p&gt;Happy debugging!
Cheers,
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>