<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>9554</bug_id>
          
          <creation_ts>2016-04-28 13:11:34 +0000</creation_ts>
          <short_desc>Add section for on-target debugging</short_desc>
          <delta_ts>2016-10-03 14:41:55 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>9</classification_id>
          <classification>Documentation</classification>
          <product>Development Manual</product>
          <component>development</component>
          <version>2.1</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>03 Oct 2016: RESOLVED</status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.2 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Scott Rifenbark">srifenbark</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>leonardo.sandoval.gonzalez</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
    
    <cc>srifenbark</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Done (doc changes complete)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>61792</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-04-28 13:11:34 +0000</bug_when>
    <thetext>We have a nice big section about using GDB to do remote debugging, but before this in the manual to we should have a short section on using gdb to do on-target debugging, case in case someone thinks that this isn&apos;t possible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62672</commentid>
    <comment_count>1</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-06-06 18:03:55 +0000</bug_when>
    <thetext>Ross, 

Can you give me some steps here on which I can base a new section for on-target debugging?  Once I have that, I can create something.

Thanks, 
Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66423</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-09-21 16:08:32 +0000</bug_when>
    <thetext>http://www.yoctoproject.org/docs/latest/dev-manual/dev-manual.html#platdev-gdb-remotedebug is the existing documentation for remote debugging.  To avoid confusion - we&apos;ve had people on IRC ask if target gdb works because it&apos;s not documented - we need to cover this too.

Basically this is just a matter of ensuring that gdb is on the target (add gdb to IMAGE_INSTALL, or tools-debug to IMAGE_FEATURES), and that debug symbols are present (either manually install with IMAGE_INSTALL foo-dbg, or dbg-pkgs to IMAGE_FEATURES for all of them).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66525</commentid>
    <comment_count>3</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-09-22 22:18:35 +0000</bug_when>
    <thetext>Ross, 

This is my best guess at the actual settings I need to use based on what you said in Comment 2.  Please look this section over and suggest filler, whatever, that the user would need.  I don&apos;t really know too much about this so I am relying on you to fill in the blanks and correct it. 

Also, I see I don&apos;t own this bug but there is a clear documentation component for it.  

Thanks, 
scott

http://www.yoctoproject.org/docs/2.2/dev-manual/dev-manual.html#debugging-with-the-gnu-project-debugger-gdb-on-the-target</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66548</commentid>
    <comment_count>4</comment_count>
    <who name="Jose Lamego">jose.a.lamego</who>
    <bug_when>2016-09-23 14:16:51 +0000</bug_when>
    <thetext>Scott, I like your paragraph. I would only add a minor explanation on why target debugging is not the most usual case, and a note on how to improve the debug information. Here&apos;s what I suggest:
_____________________________________________________________________________

The previous section addressed using GDB remotely for debugging purposes, which is the most usual case due to the inherent hardware limitations on many embedded devices, but debugging in the target hardware itself is also possible with the most powerful devices. This section describes what you need to do in order to support using GDB to debug on the target hardware.

To support this kind of debugging, you need do the following:

Ensure that GDB is on the target. You can do this by adding &quot;gdb&quot; to IMAGE_INSTALL:

     IMAGE_INSTALL_append = &quot; gdb&quot;
                    
Alternatively, you can add &quot;tools-debug&quot; to IMAGE_FEATURES:

     IMAGE_FEATURES = tools-debug
                    
Ensure that debug symbols are present. You can make sure these symbols are present by installing -dbg:

     IMAGE_INSTALL_append = &quot; packagename-dbg&quot;
                    
Alternatively, you can do the following to include all the debug symbols:

     IMAGE_FEATURES = dbg-pkgs
     
    Note: To improve the debug information accuracy, you can reduce the level of optimization used by the compiler. For example, when adding the following line to you local.conf file you will reduce optimization from FULL_OPTIMIZATION (-O2) to DEBUG_OPTIMIZATION (-O -fno-omit-frame-pointer):
        DEBUG_BUILD = &quot;1&quot; 
    Consider that this will reduce the application&apos;s performance and is recommended only for debugging purposes.
_____________________________________________________________________________

Also, feel free to assign this bug to yourself. Let me know if more is needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66557</commentid>
    <comment_count>5</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-09-23 16:19:48 +0000</bug_when>
    <thetext>Thanks Jose for the additional detail.  See http://www.yoctoproject.org/docs/2.2/dev-manual/dev-manual.html#debugging-with-the-gnu-project-debugger-gdb-on-the-target for the changed section.  Let me know if anything further needs to be done.

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66578</commentid>
    <comment_count>6</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-09-26 14:15:33 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; Thanks Jose for the additional detail.  See
&gt; http://www.yoctoproject.org/docs/2.2/dev-manual/dev-manual.html#debugging-
&gt; with-the-gnu-project-debugger-gdb-on-the-target for the changed section. 
&gt; Let me know if anything further needs to be done.
&gt; 
&gt; Scott

Scott, just minor changes:

&quot;However, debugging in the target hardware itself is also possible with more powerful devices&quot;

instead of 

&quot;However, debugging in the target hardware itself is also possible with the most powerful devices&quot;

Also, the IMAGE_FEATURES is enclosed by quotes (in both cases)

IMAGE_FEATURES = &quot; tools-debug&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66587</commentid>
    <comment_count>7</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-09-26 16:11:44 +0000</bug_when>
    <thetext>Hi, 

Thanks for the feedback.  See http://www.yoctoproject.org/docs/2.2/dev-manual/dev-manual.html#debugging-with-the-gnu-project-debugger-gdb-on-the-target for the changes.  Let me know if anything further is needed. 

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66636</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-09-27 15:25:37 +0000</bug_when>
    <thetext>Probably best to use IMAGE_FEATURES_append instead of just IMAGE_FEATURES in the examples.  Apart from that looks good to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66688</commentid>
    <comment_count>9</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-09-28 15:25:15 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; Probably best to use IMAGE_FEATURES_append instead of just IMAGE_FEATURES in
&gt; the examples.  Apart from that looks good to me.

You are right Ross. We do not want to override possible previous image&apos;s features.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66804</commentid>
    <comment_count>10</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-10-03 14:41:55 +0000</bug_when>
    <thetext>Ross and Leonardo, 

See http://www.yoctoproject.org/docs/2.2/dev-manual/dev-manual.html#debugging-with-the-gnu-project-debugger-gdb-on-the-target for the update.  I am setting the bug to RESOLVED now and turning the doc flag to &quot;done.&quot;

Thanks, 
Scott</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>