deleted>Frq07399 mNo edit summary |
Registered User m (→References) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude> | <noinclude>{{ApplicableFor | ||
{{ | |MPUs list=STM32MP13x, STM32MP15x | ||
|MPUs checklist=STM32MP13x,STM32MP15x | |||
}}</noinclude> | |||
</noinclude> | |||
== Article purpose == | == Article purpose == | ||
This article provides the basic information needed to start using the Linux tool: '''ltrace'''<ref name=ltracedotorg/>. | This article provides the basic information needed to start using the Linux tool: '''ltrace'''<ref name=ltracedotorg/>. | ||
Line 19: | Line 14: | ||
''Its use is very similar to [[Strace|strace]]''. | ''Its use is very similar to [[Strace|strace]]''. | ||
| {{N}} || {{N}} || {{Y}} | | {{N}} || {{N}} || {{Y}} | ||
| | | {{N}} || {{N}} || {{N}} | ||
|- | |- | ||
</onlyinclude> | </onlyinclude> | ||
Line 37: | Line 32: | ||
These steps are described below: | These steps are described below: | ||
* Create an area to store the ltrace libs and binaries that are to be compiled for your target board: | * Create an area to store the ltrace libs and binaries that are to be compiled for your target board: | ||
{{PC$}} cd | {{PC$}} cd <''your_local_dir''> | ||
{{PC$}} mkdir ltrace_target | {{PC$}} mkdir ltrace_target | ||
* Get the application source code: | * Get the application source code: | ||
{{PC$}} cd ltrace_target | {{PC$}} cd ltrace_target | ||
{{PC$}} wget https://www.ltrace.org/ltrace_ | {{PC$}} wget https://www.ltrace.org/ltrace_<''latest_ltrace_version''>.orig.tar.bz2 && tar xvf ltrace_<''latest_ltrace_version''>.orig.tar.bz2 && cd ltrace-<''latest_ltrace_version''> | ||
Example with ltrace version 0.7.3: | Example with ltrace version 0.7.3: | ||
{{PC$}}wget https://www.ltrace.org/ltrace_0.7.3.orig.tar.bz2 && tar xvf ltrace_0.7.3.orig.tar.bz2 && cd ltrace-0.7.3 | {{PC$}} wget https://www.ltrace.org/ltrace_0.7.3.orig.tar.bz2 && tar xvf ltrace_0.7.3.orig.tar.bz2 && cd ltrace-0.7.3 | ||
* Install and set up a cross compilation environment using SDK: See [[Cross-compile with OpenSTLinux SDK#Adding Linux user space applications|Cross-compile Linux user space application with OpenSTLinux SDK]] | * Install and set up a cross compilation environment using SDK: See [[Cross-compile with OpenSTLinux SDK#Adding Linux user space applications|Cross-compile Linux user space application with OpenSTLinux SDK]] | ||
Line 55: | Line 50: | ||
* Install the binary file on the target using network link: | * Install the binary file on the target using network link: | ||
{{PC$}} scp ltrace root@ | {{PC$}} scp ltrace root@<''ip_of_board''>:/usr/bin/ | ||
}} | }} | ||
Line 62: | Line 57: | ||
To include '''ltrace''' in your Distribution Package image build, please follow steps below: | To include '''ltrace''' in your Distribution Package image build, please follow steps below: | ||
* Add ltrace package for the image building | * Add ltrace package for the image building | ||
{{PC$}} cd {{ | {{PC$}} cd {{HighlightParam|''<your_Distribution_Package_root_dir>''}} | ||
{{PC$}} echo 'IMAGE_INSTALL_append += "ltrace"' >> meta-st/meta-st-openstlinux/recipes-st/images/st-image-weston.bbappend | {{PC$}} echo 'IMAGE_INSTALL_append += "ltrace"' >> layers/meta-st/meta-st-openstlinux/recipes-st/images/st-image-weston.bbappend | ||
* Rebuild your full image | * Rebuild your full image | ||
{{PC$}} bitbake {{ | {{PC$}} bitbake {{HighlightParam|''<full_image_name>''}} # Needed to include ltrace into the final image rootfs | ||
* Reload the new image on your board: see [[STM32MP1 Distribution Package#Flashing the built image|Flashing the built image]] <br> | * Reload the new image on your board: see [[STM32MP1 Distribution Package#Flashing the built image|Flashing the built image]] <br> | ||
== Getting started == | == Getting started == | ||
To use '''ltrace''', there are two main methods: | To use '''ltrace''', there are two main methods: | ||
* by giving, as parameter, the name of program for which you want to list dynamic library calls, and its arguments if required: | * by giving, as parameter, the name of program for which you want to list dynamic library calls, and its arguments if required: | ||
{{Board$}} ltrace {{ | {{Board$}} ltrace {{HighlightParam|''<Program>'' [''ARGS'']}} | ||
:As example: | :As example: | ||
{{Board$}} ltrace weston-simple-egl | {{Board$}} ltrace weston-simple-egl | ||
Line 93: | Line 85: | ||
* by giving, as parameter, the PID of the process to be studied: | * by giving, as parameter, the PID of the process to be studied: | ||
{{Board$}} ltrace -p {{ | {{Board$}} ltrace -p {{HighlightParam|''<PID>''}} | ||
{{highlight|Note: {{ | {{highlight|Note: {{HighlightParam|''<PID>''}} value can be replace by {{HighlightParam|''`pidof <process_name>`''}}}} | ||
:As example: | :As example: | ||
{{Board$}} weston-simple-egl & ltrace -p `pidof weston-simple-egl` | {{Board$}} weston-simple-egl & ltrace -p `pidof weston-simple-egl` | ||
Line 121: | Line 113: | ||
== References == | == References == | ||
<references /> | <references /> | ||
*Useful external links | *Useful external links | ||
Line 141: | Line 132: | ||
| User Guide | | User Guide | ||
| go4expert.com | | go4expert.com | ||
| | |} | ||
<noinclude> | |||
| | {{ ArticleBasedOnModel | Trace and debug tools article model }} | ||
| | {{ PublicationRequestId | 9773 | 07Dec'18 }} | ||
|} | [[Category:Linux tracing tools]] | ||
</noinclude> |
Latest revision as of 15:01, 2 November 2022
1. Article purpose
This article provides the basic information needed to start using the Linux tool: ltrace[1].
2. Introduction
The following table provides a brief description of the tool, as well as its availability depending on the software packages:
Template:Y: this tool is either present (ready to use or to be activated), or can be integrated and activated on the software package.
Template:N: this tool is not present and cannot be integrated, or it is present but cannot be activated on the software package.
Tool | STM32MPU Embedded Software distribution | STM32MPU Embedded Software distribution for Android™ | ||||||
---|---|---|---|---|---|---|---|---|
Name | Category | Purpose | Starter Package | Developer Package | Distribution Package | Starter Package | Developer Package | Distribution Package |
ltrace | Tracing tools | ltrace[1] is used to display the calls to shared libraries made by a userspace application. ltrace is a userspace application. Its use is very similar to strace. |
Template:N | Template:N | Template:Y | Template:N | Template:N | Template:N |
3. Installing the trace and debug tool on your target board
3.1. Using the STM32MPU Embedded Software distribution
3.1.1. Distribution Package
To include ltrace in your Distribution Package image build, please follow steps below:
- Add ltrace package for the image building
Template:PC$ cd <your_Distribution_Package_root_dir> Template:PC$ echo 'IMAGE_INSTALL_append += "ltrace"' >> layers/meta-st/meta-st-openstlinux/recipes-st/images/st-image-weston.bbappend
- Rebuild your full image
Template:PC$ bitbake <full_image_name> # Needed to include ltrace into the final image rootfs
- Reload the new image on your board: see Flashing the built image
4. Getting started
To use ltrace, there are two main methods:
- by giving, as parameter, the name of program for which you want to list dynamic library calls, and its arguments if required:
Template:Board$ ltrace <Program> [ARGS]
- As example:
Template:Board$ ltrace weston-simple-egl __libc_start_main(0x11a90, 1, 0xbec45d04, 0x131f0 <unfinished ...> memset(0xbec456f8, 0, 72, 0x11a90) = 0xbec456f8 memset(0xbec45754, 0, 68, 0xbec45740) = 0xbec45754 wl_display_connect(0, 250, 32, 0xbec45750) = 0x26150 wl_proxy_marshal_constructor(0x26150, 1, 0x24e90, 0) = 0x2a268 wl_proxy_add_listener(0x2a268, 0x132e0, 0xbec456f8, 0) = 0 wl_display_roundtrip(0x26150, 0x132e0, 0xbec456f8, 0 <unfinished ...> strcmp(0x2a404, 0x133e8, 1, 0x2a404) = 0 wl_proxy_marshal_constructor_versioned(0x2a268, 0, 0x24ed8, 1) = 0x2b070 strcmp(0x2a49c, 0x133e8, 2, 0x2a49c) = 16 strcmp(0x2a49c, 0x133f8, 115, 0x635f6c77) = -3 ...
- by giving, as parameter, the PID of the process to be studied:
Template:Board$ ltrace -p <PID>
- As example:
Template:Board$ weston-simple-egl & ltrace -p `pidof weston-simple-egl` has EGL_EXT_buffer_age and EGL_EXT_swap_buffers_with_damage glGetShaderiv(1, 0x8b81, 0xbee14260, 0) = 0 glCreateShader(0x8b31, 0x8b31, 256, 1) = 2 glShaderSource(2, 1, 0xbee1425c, 0) = 0x1a96f0 glCompileShader(2, 0, 154, 0xbee14260) = 1 glGetShaderiv(2, 0x8b81, 0xbee14260, 0) = 0 glCreateProgram(2, 2, 256, 1) = 3 glAttachShader(3, 1, -1, 1) = 0 glAttachShader(3, 2, 0x8b30, 1) = 0 glLinkProgram(3, 0x8dd9, 0x8b31, 1) = 0x285234 glGetProgramiv(3, 0x8b82, 0xbee14698, 0) = 0 glUseProgram(3, 3, 256, 1) = 1 glBindAttribLocation(3, 0, 0x13884, 1) = 1 glBindAttribLocation(3, 1, 0x13888, 0) = 1 glLinkProgram(3, 0x1388e, 0, 0x1b9090) = 1 ... Template:Board$ killall weston-simple-egl
5. To go further
Other options can be set. For details, please refer to the manual page[2].
6. References
- Useful external links
Document link | Document Type | Description |
---|---|---|
ltrace linux.die.net | Standard | linux.die.net |
ltrace wikipedia.org | Standard | wikipedia.org |
ltrace tutorial | User Guide | go4expert.com |