Bug 9554 - Add section for on-target debugging
Summary: Add section for on-target debugging
Status: RESOLVED FIXED
Alias: None
Product: Development Manual
Classification: Documentation
Component: development (show other bugs)
Version: 2.1
Hardware: All Multiple
: Medium+ normal
Target Milestone: 2.2 M4
Assignee: Scott Rifenbark
QA Contact:
URL:
Whiteboard: 03 Oct 2016: RESOLVED
Depends on:
Blocks:
 
Reported: 2016-04-28 13:11 UTC by Ross Burton
Modified: 2016-10-03 14:41 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Done (doc changes complete)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2016-04-28 13:11:34 UTC
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't possible.
Comment 1 Scott Rifenbark 2016-06-06 18:03:55 UTC
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
Comment 2 Ross Burton 2016-09-21 16:08:32 UTC
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've had people on IRC ask if target gdb works because it'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).
Comment 3 Scott Rifenbark 2016-09-22 22:18:35 UTC
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'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'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
Comment 4 Jose Lamego 2016-09-23 14:16:51 UTC
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'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 "gdb" to IMAGE_INSTALL:

     IMAGE_INSTALL_append = " gdb"
                    
Alternatively, you can add "tools-debug" 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 = " packagename-dbg"
                    
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 = "1" 
    Consider that this will reduce the application'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.
Comment 5 Scott Rifenbark 2016-09-23 16:19:48 UTC
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
Comment 6 Leonardo Sandoval Gonzalez 2016-09-26 14:15:33 UTC
(In reply to comment #5)
> 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

Scott, just minor changes:

"However, debugging in the target hardware itself is also possible with more powerful devices"

instead of 

"However, debugging in the target hardware itself is also possible with the most powerful devices"

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

IMAGE_FEATURES = " tools-debug"
Comment 7 Scott Rifenbark 2016-09-26 16:11:44 UTC
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
Comment 8 Ross Burton 2016-09-27 15:25:37 UTC
Probably best to use IMAGE_FEATURES_append instead of just IMAGE_FEATURES in the examples.  Apart from that looks good to me.
Comment 9 Leonardo Sandoval Gonzalez 2016-09-28 15:25:15 UTC
(In reply to comment #8)
> Probably best to use IMAGE_FEATURES_append instead of just IMAGE_FEATURES in
> the examples.  Apart from that looks good to me.

You are right Ross. We do not want to override possible previous image's features.
Comment 10 Scott Rifenbark 2016-10-03 14:41:55 UTC
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 "done."

Thanks, 
Scott