Bug 580644 - steps into the function of shared library does not work on PPC
Summary: steps into the function of shared library does not work on PPC
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Agent (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Eugene Tarassov CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-31 00:52 EDT by wenyan xin CLA
Modified: 2022-09-20 13:08 EDT (History)
1 user (show)

See Also:


Attachments
reproducible case (515 bytes, application/gzip)
2022-08-31 01:04 EDT, wenyan xin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description wenyan xin CLA 2022-08-31 00:52:06 EDT
Debug a process with shared library, when try to step into a shared library function, the next source line should be into the shared library function, but on qemuppc, it stepped first in some assemble language, after several step into, then it stepped into the shared library function.

But on qemuarm64, it stepped directly into the function.

I use the kirkstone branch of poky of yocto for qemuppc.
Comment 1 wenyan xin CLA 2022-08-31 00:53:49 EDT
And on our side, If we debugged it on PPC64, it stepped first into call_plt function as following:

(wrdbg) n
sharedLibTestLibRtn result is: 15.707951
sharedLibTestLibRtn1 called: bonjour mon ami
52	    sharedLibTestLibRtn (5);
(wrdbg) s
0x0000000004001140 in 00000018.plt_call.sharedLibTestLibRtn () at 00000018.plt_call.sharedLibTestLibRtn
No source file available for this address.
(wrdbg) bt
#0  0x0000000004001140 in 00000018.plt_call.sharedLibTestLibRtn () at 00000018.plt_call.sharedLibTestLibRtn
#1  0x0000000004001a8c in main () at sharedLibTest.c:52
#2  0x00000000040014b8 at _start+0xb4
(wrdbg)


please note the plt_call function.
Comment 2 wenyan xin CLA 2022-08-31 00:58:46 EDT
BTW:

Do you know why the Yocto disables the Breakpoints, StackTrace , etc. on PPC64, RISC-V? that means we cannot debug on PPC64 through tcf-agent.

in file meta/recipes-devtools/tcf-agent/tcf-agent_git.bb:

LCL_STOP_SERVICES = "-DSERVICE_RunControl=0 -DSERVICE_Breakpoints=0 \
    -DSERVICE_Memory=0 -DSERVICE_Registers=0 -DSERVICE_MemoryMap=0 \
    -DSERVICE_StackTrace=0 -DSERVICE_Expressions=0"


# These features don't compile for several cases.
#
CFLAGS:append:arc = " ${LCL_STOP_SERVICES}"
CFLAGS:append:mips = " ${LCL_STOP_SERVICES}"
CFLAGS:append:mips64 = " ${LCL_STOP_SERVICES}"
CFLAGS:append:libc-musl = " ${LCL_STOP_SERVICES}"
CFLAGS:append:powerpc64 = " ${LCL_STOP_SERVICES}"
CFLAGS:append:powerpc64le = " ${LCL_STOP_SERVICES}"
CFLAGS:append:riscv64 = " ${LCL_STOP_SERVICES}"
CFLAGS:append:riscv32 = " ${LCL_STOP_SERVICES}"
Comment 3 wenyan xin CLA 2022-08-31 01:04:07 EDT
Created attachment 288704 [details]
reproducible case
Comment 4 wenyan xin CLA 2022-09-13 03:02:24 EDT
how about this issue?

it can not reproduce?
Comment 5 wenyan xin CLA 2022-09-13 03:02:39 EDT
thank very much.
Comment 6 Eugene Tarassov CLA 2022-09-14 00:18:29 EDT
I cannot reproduce. What version of gcc do you use?

> Do you know why the Yocto disables the Breakpoints, StackTrace...

No idea, I don't know much about Yocto.
Comment 7 wenyan xin CLA 2022-09-14 00:42:58 EDT
I tested this case on Ubuntu 20.04.4 LTS with Yocto kirkstone branch.

1,
git clone git://git.yoctoproject.org/poky
git checkout -t origin/kirkstone -b my-kirkstone

2, source oe-init-build-env build-ppc

3, added the following line to conf/local.conf file under build-ppc dir:
MACHINE ?= "qemuppc"

4, bitbake core-image-full-cmdline
5, runqemu qemuppc

then built the attached case in embedded Linux and debugged it. when debugging it, stepped into a shared library function, the next line is not in the shared library function.

all others are default, we did not change any other thing.

-------------------------------------------------------
pek-wb-u20: ~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

Release:        20.04
Codename:       focal
Comment 8 wenyan xin CLA 2022-09-14 21:40:54 EDT
3, added the following two lines to conf/local.conf file under build-ppc dir:
MACHINE ?= "qemuppc"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks tools-sdk tools-debug eclipse-debug tools-testapps"

5, runqemu nographic
Comment 9 Eugene Tarassov CLA 2022-09-20 13:08:40 EDT
I have committed a fix.
Thanks!