In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what is the use of the ltrace command in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The ltrace command, which is commonly used in Linux, is used to track when a process calls library functions.
Ltrace is used to track when a process calls library functions.
Syntax ltrace [option...] [command [arg...]] Option-an aligns the return value of a specific column. -c calculates the time and call, and prints a summary when the program exits. -C decodes the low-level name (kernel level) as the user-level name. -d print debugging information. -e changes the tracked event. -f track child processes. -h print help information. -I print the instruction pointer when the library is called. -l prints only calls in a library. -L does not print library calls. -n,-- indent=NR indents each call level with NR spaces. -o,-- output=file directs the output to a file. -p PID is attached to the process number with the value PID for ltrace. -r prints a relative timestamp. -s STRLEN sets the maximum length of the printed string. -S displays the system call. -t,-tt,-ttt prints an absolute timestamp. -T outputs the time cost of each calling procedure. -u USERNAME uses a user id or group ID to run the command. -V,-- version prints version information, and then exits. -x NAME treat the global NAME like a library subroutine. (for translation) the most basic application of an example, without any parameters:
[guest@localhost tmp] $ltrace. / a.out _ libc_start_main (0x80484aa, 1, 0xbfc07744, 0x8048550, 0x8048540 printf ("no1:%d\ t no2:%d\ t diff:%d\ n", 10, 6, 4no1:10 no2:6 diff:4) = 24 printf ("no1:%d\ t no2:%d\ t diff:%d\ n", 9, 7, 2no1:9 no2:7 diff:2) = 23 printf ("no1:%d\ t no2:%d\ t diff:%d\ n" 8, 8, 0no1:8 no2:8 diff:0) = 23-SIGFPE (Floating point exception)-+ killed by SIGFPE + output call time cost:
[guest@localhost tmp] $ltrace-T. / a.out _ libc_start_main (0x80484aa, 1, 0xbf81d394, 0x8048550, 0x8048540 printf ("no1:%d\ t no2:%d\ t diff:%d\ n", 10, 6, 4no1:10 no2:6 diff:4) = 24 printf ("no1:%d\ t no2:%d\ t diff:%d\ n", 9, 7 2no1:9 no2:7 diff:2) = 23 printf ("no1:%d\ t no2:%d\ t diff:%d\ n", 8, 8, 0no1:8 no2:8 diff:0) = 23-SIGFPE (Floating point exception)-+ killed by SIGFPE + displays the system call:
[guest@localhost tmp] $ltrace-S. / a.out SYS_brk (NULL) = 0x9e20000 SYS_access (0xa4710f, 4, 0xa4afc0, 0, 0xa4b644) = 0 SYS_open ("/ etc/ld.so.preload", 0,02) = 3 SYS_fstat64 (3, 0xbfbd7a94, 0xa4afc0,-1,3) = 0 SYS_mmap2 (0,17,3,2,3) = 0xb7f2a000 SYS_close (3) = 0 SYS_open ("/ lib/libcwait.so", 0,00) = 3 SYS_read (3) SYS_fstat64 (3, 0xbfbd76fc, 0xa4afc0, 4, 0xa4b658) = 0 SYS_mmap2 (0, 4096, 3, 34,-1) = 0xb7f29000 SYS_mmap2 (0, 5544, 5, 2050, 3) = 0x423000 SYS_mmap2 (0x424000, 4096, 3, 2066, 3) = 0x424000. Omitting a few lines is all the content of the article "what is the use of ltrace commands in Linux?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.