layout: post
title: “Debug lib in Linux”
date: 2019-08-28 12:25:06
description: lib and performance debug
tags:
- code
Command
- ldd
ldd /usr/sbin/apache2|grep libc.so
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2a337d8000) - create probe
perf probe -x /lib/x86_64-linux-gnu/libc.so.6 malloc
perf probe -l -
record
perf record -e probe_libc:malloc -a -p 15640 –call-graph dwarf
perf report - result
```
Samples: 3K of event ‘probe_libc:malloc’, Event count (approx.): 3770
Children Self Command Shared Object Symbol ▒ - 99.89% 99.89% java libc-2.19.so [.] malloc ▒
- 32.07% 0.00% java perf-30529.map [.] 0x00007fcd4d37c827 ◆
- 32.07% 0.00% java libsunec.so [.] Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair ▒
- 31.91% 0.00% java perf-30529.map [.] 0x00007fcd4d383675 ▒
- 31.91% 0.00% java libsunec.so [.] Java_sun_security_ec_ECDHKeyAgreement_deriveKey ▒
- 23.47% 0.00% java libc-2.19.so [.] __strdup ▒
- 21.72% 0.00% java libsunec.so [.] 0x000000000000ab61 ▒
- 21.09% 0.00% java libsunec.so [.] 0x0000000000010158
```