Why is there a problem using CodeWarrior to debug a multi-threaded program?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why is there a problem using CodeWarrior to debug a multi-threaded program?

718 Views
evaneimer
Contributor I

I am having a problem using CodeWarrior to debug a multi-threaded program.
I am using an eval version of CodeWarrior:
CodeWarrior for Power Architecture, Version: 10.5.1 Build Id:160128
My target is a NXP T2080RDB, REV C.
I am using a yocto generated build from QorIQ-SDK-V2.0-20160527-yocto.


In general, everything is working fine. I can create projects and run them
on the T2080RDB. I can also use the debugger to Download or Attach to simple single-threaded and debug them.
However, if I try to debug a multi-threaded program, I can only set breakpoints and debug the "parent"
thread. If I set a breakpoint in a "child" thread, and that line of code gets executed, the debug session is
immediately terminated and I get an error message on the console:
TwoThreads.elf[2164]: unhandled signal 4 at 0000000010000b30 nip 0000000010000b30 lr 0000000010000b5c code 30001

 

Attached is the very simple TwoThreads program which exhibits the problem I am encountering.
For example, setting a breakpoint at the "sleep(2);" line causes the debug session to terminate.

 

I saw some similiar problem discussions talking about the need to run with non-stripped version of certain libraries.
From October 15, 2013, "Why does CodeWarrior halt unexpectedly when debugging threads?".
Is this my problem? - Do I need unstripped libraries?
If so, how do I know what files/libraries I need and where do I get them, or how do I generate them?

 

Note: At the moment, I am only trying to debug user space applications.

 

Note: I also get the following warning when I start AppTRK:
Warning: /lib64/ld64.so.1 used by /var/volatile/tmp/TwoThreads.elf
The dynamic loader does not contain the symbols needed for shared
library debugging. To enable shared library debugging, use an
un-stripped version of this library.

Thanks in advance.

Original Attachment has been moved to: TwoThreads.elf.zip

Original Attachment has been moved to: main.c.zip

0 Kudos
Reply
1 Reply

558 Views
yipingwang
NXP TechSupport
NXP TechSupport

You need to use unstripped ld and libpthread libraries, please try to use the following method to rebuild and regenerate rootfs filesystem to include the unstripped libs.

Please edit the recipe sources/meta-freescale/recipes-fsl/images/fsl-image-core.bb, add "glibc-dbg" in the variable IMAGE_INSTALL_append, and add the following at the end of the recipe file. I attached the recipe file for you.

 

ROOTFS_POSTPROCESS_COMMAND += "copy_lib;"

 

copy_lib(){

 

    cp -r ${IMAGE_ROOTFS}/lib64/.debug/ld-2.20.so ${IMAGE_ROOTFS}/lib64/ld-2.20.so;

    cp -r ${IMAGE_ROOTFS}/lib64/.debug/libpthread-2.20.so ${IMAGE_ROOTFS}/lib64/libpthread-2.20.so;

}

 

Please run "bitbake fsl-image-core" to generate the rootfs filesystem including the not stripped lib file.


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply