Fix a bug where processes that didn't have a leading space from right
justification of the pid column would return the process name instead
of the pid, by switching to pgrep.
Bug: http://b/111748205
Test: manual
Change-Id: I3493474540ccfa89f5bb3e66153d9e96ec8bf1d9
This only includes a few tests to start with.
Bug: 62492960
Test: Ran new unit tests.
Test: Ran with all different options and verified it produces the same
Test: output as the previous script.
Change-Id: Iad29a5f04f49986139c92030a3259cae512859af
In Android P, the version field did not get incremented properly in
all places. So if a file with a v1.0 version is found, do a further check
to verify if the num field is really valid.
Test: Verified that a file with v1.0 gets checked and the valid num field
Test: is set correctly.
Test: Verified that a file with v1.1 automatically gets num field set to
Test: valid.
Change-Id: I7f828294c833e334cad76a866bbaa1d78ac02cfb
Merged-In: I7f828294c833e334cad76a866bbaa1d78ac02cfb
(cherry picked from commit b558fe4d53)
Switching from remote to extended-remote allows the program being
debugged to be restarted like a normal non-remote program.
Test: Used gdbclient debugging ICU things for a while, restarted often
Bug: None
Change-Id: Ia295749b9aa86727479d760d7c743f98a06fa6d4
Make it so that these can be used in other scripts by moving them from
functions defined in envsetup.sh to standalone scripts.
Test: stacks zygote64
Change-Id: I55ba76b248c54d9193fb019b7f4aca2f4c3a05bd
`pid zygote` will match zygote64 as well, but someone using `stacks
zygote` clearly wants the 32-bit version. Attempt an exact match before
we try a nonexact one.
Test: stacks zygote
Test: stacks zygote64
Change-Id: I5fd75cdbe4982c7ea831749c9ba823a2451e5490
Update for newer debuggerd output marking the memory dump around
the currently executed code.
Add a hack for ARM assembly: override the assembler-emitted $d
symbol marking all our .byte data, so that objdump will disassemble
as instructions.
Test: manual
Change-Id: I100ed9e0ce39c073d5885cc430d78c24fef38882
The new version of malloc debug supports using a num field that is more
than one. Modify the parser to handle this case.
Bug: 74361929
Test: Ran on a file that contained non-one numbers and verified the output.
Change-Id: I158922e51ce99afff88f20a80df414d653f95e65
make dumpvar takes forever (~0.45s per variable on my machine), and the
information we want from it is already available in the environment.
Construct the paths we need ourselves, instead of relying on make to do
it for us, shaving off about a second from a gdbclient.py invocation.
Test: gdbclient.py -r ls
Change-Id: I8c563da726c8f61a23e2eb701f2f272a4c71d713
gdbclient.py -r allows to provide an executable to be run on the target.
Before this patch the absolute path of the executable had to be
provided. This was inconvenient as the user has to first look up for the
exe on the target before debuging it.
With this patch, gdbclient.py will look for the executable on the
target if an absolute path is not provided.
Test: gdbserver -r ls
Change-Id: I610fd0a57b034ba8864874eeb1f7345d4a7daad9
Signed-off-by: Kevin Rocard <krocard@google.com>
Users of gdbclient might not know that a new and improved version exist
in the form of gdbclient.py.
Change-Id: I65243a8d25a1ecbe8ff734d0be4dbe40b50db4b2
Signed-off-by: Kevin Rocard <krocard@google.com>
When using logwrapper, there is only a zygote heap. This caused
a divide by zero for the app heap.
Test: native_heapdump_viewer.py --html art/native_heap.txt > test.html
Change-Id: I7defd94935d72ee9c4cb6e53d7a1a308a1030eb3
Properties can include \n so get_props isn't sound, and it's not obvious how
to fix it (without adding something like cat's -v to getprop, which wouldn't
help the intended use case of working with arbitrary old devices).
Bug: https://issuetracker.google.com/37093233
Test: gdbclient -r /system/bin/date
Change-Id: I96042fd44f1de17974968954fab6c916a9d13b61
Switch from assuming that "root" meant su to an explicit prepended
argument, to allow things like `gdbclient.py --user shell`.
Test: gdbclient.py --user shell -r /system/bin/ls
Change-Id: I9d02eea7c6d79898ed8b13817e009630b0f9536a
If there are no bytes attributable to APP, then you get a divide
by zero. Modify the code to avoid doing a divide by zero.
This can happen when using logwrapper to enable malloc debug.
Test: Ran on a heap that had no APP bytest.
Change-Id: I48f0666a92b591e4537c493c56b136e517a36c25
Usage:
1. Collect a native heap dump from the device. For example:
$ adb shell stop
$ adb shell setprop libc.debug.malloc.program app_process
$ adb shell setprop libc.debug.malloc.options backtrace=64
$ adb shell start
(launch and use app)
$ adb shell am dumpheap -n <pid> /data/local/tmp/native_heap.txt
$ adb pull /data/local/tmp/native_heap.txt
2. Run the viewer:
$ python native_heapdump_viewer.py [options] native_heap.txt
[--verbose]: verbose output
[--html]: html output
[--symbols SYMBOL_DIR]: SYMBOL_DIR is the directory containing the
.so files with symbols. Defaults to $ANDROID_PRODUCT_OUT/symbols
This outputs a file with lines of the form:
5831776 29.09% 100.00% 10532 71b07bc0b0 /system/lib64/libandroid_runtime.so Typeface_createFromArray frameworks/base/core/jni/android/graphics/Typeface.cpp:68
5831776 is the total number of bytes allocated at this stack frame, which
is 29.09% of the total number of bytes allocated and 100.00% of the parent
frame's bytes allocated. 10532 is the total number of allocations at this
stack frame. 71b07bc0b0 is the address of the stack frame.
For generating interactive HTML output, use:
python native_heapdump_viewer.py --html [options] native_heap.txt > allocations.html
Then open allocations.html in a browser. Clicking on nodes will
expand the tree.
Test: Try script on an app following usage instructions.
Bug: 36457259
Change-Id: I18dfe9a00fc1d3e82673dbfb4b5be3dc10480cec