Commit Graph

301 Commits

Author SHA1 Message Date
Automerger Merge Worker
c726424b42 Merge "Add support for xxx.so!xxx.so lines." am: 197cd3d795 am: dc6db11f99 am: 094e559462
Change-Id: I55765fa70a454a849f53d59a255f225f7f49aa23
2020-02-01 04:53:20 +00:00
Christopher Ferris
5e4b37213d Add support for xxx.so!xxx.so lines.
When seeing a line like:
  #01 pc 0012ea14  /system/lib/libart.so!libart.so (offset 0x134000)

Treat it like this line instead:
  #01 pc 0012ea14  /system/lib/libart.so

This will allow the symbolizer to properly figure out the line numbers.

Bug: 148657674

Test: Ran lines with xxx.so!xxx.so lines and verified that they decode.
Change-Id: Ieea516b46a00b414c740d0b4302a5cc73da2b0a8
2020-01-31 14:38:07 -08:00
Automerger Merge Worker
e751f5190d Merge "Add --lldb to gdbclient.py" am: f8514fe646 am: 21114c9277 am: a0e42ece44
Change-Id: I7f0209175ad32a574f791a3d6f3f28176a69e0c4
2020-01-07 22:36:23 +00:00
Haibo Huang
e194fcecf9 Add --lldb to gdbclient.py
Test: `gdbclient.py --lldb -r /system/bin/toybox` and try `b main` `c`
Test: `/data/local/tmp/arm64-lldb-server gdbserver :5039 /system/bin/toybox` and `gdbclient.py --lldb -p 4909`
Change-Id: If7b6895e9c778cdee3764a4058cf70238bdd6b8a
2020-01-06 14:55:28 -08:00
Stephen Hines
84fde73031 resolve merge conflicts of 6cfe24fbf7 to master
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ifba1d4d26287799e5decbd3c5cb56490d8c99afb
Exempt-From-Owner-Approval: fix merge conflict
2019-12-11 08:03:21 +00:00
Chih-Hung Hsieh
09539599a0 Add new cargo2android.py owners
* add new cargo2android.py owners
* remove obsolete email address

Bug: 142209566
Test: make
Change-Id: I22e348b45c25ccc82e59fdddf1978462ba2a8e49
2019-12-10 09:19:47 -08:00
Chih-Hung Hsieh
2978204d14 Auto-build/update codegen
Exempt-From-Owner-Approval: introduces separate utility; doesn't touch
anything around it
Test: 1. Manually enter version/presence of build artifact,
and ensure `codegen FILENAME` still works
2. run codegen again without altering version, ensure no build triggered
Change-Id: Iaa253a430e627d0e7c25781cde535958f77db97f
(cherry picked from commit 8ca7673cfc)
Merged-In: Iaa253a430e627d0e7c25781cde535958f77db97f
2019-12-10 09:17:42 -08:00
Chih-hung Hsieh
484bb18f31 Merge "A script to run cargo and generate Android.bp." am: 45ffc27e13 am: b492126ff1
am: 7a2bce40f7

Change-Id: I76f844be97537f201c17ff5f0b55f94a06777f6e
2019-12-06 13:24:24 -08:00
Chih-Hung Hsieh
e888737544 A script to run cargo and generate Android.bp.
* Usage note and help for command flags in the script.
  * Run cargo -v multiple times and collect output in cargo.out.
  * Use target.tmp as temporary working directory.
  * Generate multiple Android.bp files into subdirectories.
  * Simplified package names, without version number.
* Merged Android.bp modules.
  * Use --device flag to generate both host and device build targets
    in a combined module.
  * Use --tests flag to generate rust_test modules, with auto_gen_config,
    and multiple unit tests merged in one module.
* Generate cc_library_static modules for rust packages that call
  'cc' and 'ar' to build static C/C++ libraries.
  * Use the --vv flag to call cargo with -vv.
* Limitations:
  * Cargo.toml and its build scripts might need fix for Android first.
  * Depending on user given cargo parameters.
* TODOs:
  * Handle multiple crate types in one rustc command line.
  * Smart merge of host and device rust_test modules,
    to handle device tests that depend on dynamic libraries.
  * Handle special Rust packages that use only build scripts
    and C/C++ compilers to generate included files.

Bug: 142209566
Test: In rust project directories: cargo2android.py --run
Change-Id: Id54652b1e0a6e5fc16619cd05f5b057eee79d610
2019-12-02 15:43:04 -08:00
Mårten Kongstad
c0d319a8c3 codegen: execute using bash
On Ubuntu 18.04, /bin/sh is symlinked to dash. Executing codegen under
dash results in the following error:

  codegen: Syntax error: "(" unexpected

To prevent this, explicitly use bash.

Test: manual ($ANDROID_BUILD_TOP/development/scripts/codegen --help)
Change-Id: I11bd5e41757a8d26f5e9d7d3340306d5ff4da1f9
2019-10-04 16:48:38 -07:00
Eugene Susla
8ca7673cfc Auto-build/update codegen
Exempt-From-Owner-Approval: introduces separate utility; doesn't touch anything around it
Test: 1. Manually enter version/presence of build artifact,
and ensure `codegen FILENAME` still works
2. run codegen again without altering version, ensure no build triggered
Change-Id: Iaa253a430e627d0e7c25781cde535958f77db97f
2019-07-29 22:15:05 +00:00
Ryan Prichard
1415cbdc4e Merge "gdbclient: support various PT_INTERP values" am: 87001e7ad7
am: 018cac60a1

Change-Id: I673ceecb5e52f513fecfa7643f03435ae6ef6ae1
2019-06-12 13:13:04 -07:00
Ryan Prichard
5d1c3cb157 gdbclient: support various PT_INTERP values
gdb looks for an executable's dynamic linker using the PT_INTERP setting
from the executable. That value can be various things:
 - /system/bin/linker[64]
 - /system/bin/linker_asan[64]
 - /system/bin/bootstrap/linker[64]

Currently, only the bootstrap linker is available in the sysroot/symbols
directory. The ordinary and ASAN linkers are symlinks on the target and
are missing from the sysroot (aka symbols) directory.

Use the executable's PT_INTERP value to find the symbolized linker binary
and add it to the solib search path. If necessary, copy or pull a linker
binary.

Test: gdbclient.py -r ls
  "info sharedlib" shows $OUT/symbols/apex/com.android.runtime.debug/bin/linker64

Test: gdbclient.py -r /data/nativetest64/bionic-unit-tests/bionic-unit-tests
  "info sharedlib" shows $OUT/symbols/system/bin/bootstrap/linker64

Test: m asan_test
  gdbclient.py -r /data/nativetest64/asan_test/asan_test
  "info sharedlib" shows /tmp/gdbclient-linker-HunVs9/linker_asan64

Bug: http://b/134183407
Change-Id: I7f79943dcd9ec762d1aaf21178bb6ab3eff40617
2019-06-11 16:07:37 -07:00
Andreas Gampe
a43fb8ea6a Merge "Stack: Fix argument-less invocation" am: f54ccd7f3f
am: df910e694a

Change-Id: I344237fc13e450dd9d2b94c17eebe3e5826bedb0
2019-04-30 12:27:57 -07:00
Andreas Gampe
dcf9800c7e Stack: Fix argument-less invocation
Add nargs='?' to allow a missing positional argument.

Bug: 131662960
Test: manual
Change-Id: I47d98c7d903b0028bd9969580ff0217aaf0cfb78
2019-04-30 10:07:24 -07:00
Andreas Gampe
5c4b741476 Merge changes Ibe0c93c6,Ib7b1de46 am: 458206d64e
am: 8805a8dbcf

Change-Id: I8951e4176a1b44198a9bcf7d311ba82b9057d7bf
2019-04-09 16:16:21 -07:00
Andreas Gampe
d8c0293a33 Stack: Add ability to override symbols dir
Add --syms option to set the symbols directory used for lookup.

Test: m
Test: manual
Change-Id: Ibe0c93c68cafe017341e54e8f14ea9d775ae13bd
2019-04-08 12:32:27 -07:00
Andreas Gampe
3c9db52fd7 Stack: Replace getopt with argparse
Modernize and make it easier to add new options.

Test: m
Test: manual
Change-Id: Ib7b1de4626e6b2cd27dca1dd911c594db93cb292
2019-04-08 12:32:01 -07:00
Haibo Huang
8f4d101358 Merge "Fix gdbserver path in gdbclient.py" am: d328a9c301 am: 80db2e200a
am: 21e3836824

Change-Id: I3ec5dcdcf4abf17721ab8d610e7eecf6bc343a96
2019-03-26 17:38:08 -07:00
Haibo Huang
931cd0b237 Fix gdbserver path in gdbclient.py
gdbserver is moved in aosp/932459

Test: run gdbclient.py
Change-Id: Ia8cedfc994556bc1019649d15c91a505bdbf6dff
2019-03-26 20:58:21 +00:00
Christopher Ferris
85944576b8 Merge "Really fix support for soname in apk." am: 2f5dc0a066 am: 0a3cbe01a4
am: 279978161d

Change-Id: Ib14dcbb88c3e03642c4edc32a125fef02d6e6d17
2019-03-15 14:26:27 -07:00
Christopher Ferris
ac90d1da7e Really fix support for soname in apk.
Bug: 29218999

Test: Run a stack through vendor/google/tools/stack --auto with this change.
Change-Id: I0d650f30d37bb0dfa9db011d7624c0c74a98f2df
2019-03-15 12:21:57 -07:00
Christopher Ferris
4a3491ed0b Merge "Add support for soname display in apk." am: 3a5a1cf901 am: 246d49ded9
am: 48181e4baa

Change-Id: Ib86c157d2a388a810ee8cd204e530408934a4269
2019-03-14 09:13:46 -07:00
Christopher Ferris
55a9699db3 Add support for soname display in apk.
Bug: 29218999

Test: Verified unwind through an apk works with both formats.
Change-Id: I20dba918e94024902968ab320dc03e1e343d8a31
2019-03-13 17:08:40 -07:00
Peter Collingbourne
acb3916bea Merge "gdbclient.py: Add --env flag." am: f91fb912d3 am: 466966c66a
am: c413ff1ef7

Change-Id: I08dbb74ef537642b5b2e529852e2828e1de3ab2b
2019-02-25 18:53:10 -08:00
Treehugger Robot
f91fb912d3 Merge "gdbclient.py: Add --env flag." 2019-02-23 02:12:39 +00:00
Alex Light
d0ad924c94 Merge "gdbclient.py alternative frontend support" am: 24dc4630c7 am: c34956f0cc
am: 99742da343

Change-Id: Ie3c85a62d0603874d84012659b876b7c788b273c
2019-01-18 17:39:17 -08:00
Alex Light
92476657e3 gdbclient.py alternative frontend support
This adds a new --setup-forwarding {gdb|vscode} flag that will make
gdbclient.py (1) setup the port forwarding needed to connect to a
remote process and (2) print the commands/configuration needed to use
the frontend of your choice to run the debugger. Currently it supports
gdb and visual-studio code. In order to avoid using up all the ports
the gdbclient.py program will not exit until directed by user input,
holding the ports open until this occurs.

To use:

```
% ./development/scripts/gdbclient.py -n com.android.contacts --setup-forwarding vscode
Redirecting gdbserver output to /tmp/gdbclient.log

{
    "miDebuggerPath": "/fast-2/allight/aosp/prebuilts/gdb/linux-x86/bin/gdb",
    "program": "/fast-2/allight/aosp/out/target/product/walleye/symbols/system/bin/app_process64",
    "setupCommands": [
        {
            "text": "-enable-pretty-printing",
            "description": "Enable pretty-printing for gdb",
            "ignoreFailures": true
        },
        {
            "text": "-environment-directory /fast-2/allight/aosp",
            "description": "gdb command: dir",
            "ignoreFailures": false
        },
        {
            "text": "-gdb-set solib-search-path /fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/hw:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/ssl/engines:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/drm:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/egl:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/soundfx:/fast-2/allight/aosp/out/target/product/walleye/symbols/vendor/lib64/:/fast-2/allight/aosp/out/target/product/walleye/symbols/vendor/lib64/hw:/fast-2/allight/aosp/out/target/product/walleye/symbols/vendor/lib64/egl",
            "description": "gdb command: set solib-search-path",
            "ignoreFailures": false
        },
        {
            "text": "-gdb-set solib-absolute-prefix /fast-2/allight/aosp/out/target/product/walleye/symbols",
            "description": "gdb command: set solib-absolute-prefix",
            "ignoreFailures": false
        },
        {
            "text": "-interpreter-exec console \"source /fast-2/allight/aosp/development/scripts/gdb/dalvik.gdb\"",
            "description": "gdb command: source art commands",
            "ignoreFailures": false
        }
    ],
    "name": "(gdbclient.py) Attach app_process64 (port: 5039)",
    "miDebuggerServerAddress": "localhost:5039",
    "request": "launch",
    "type": "cppdbg",
    "cwd": "/fast-2/allight/aosp",
    "MIMode": "gdb"
}

Paste the above json into .vscode/launch.json and start the debugger as
normal. Press enter in this terminal once debugging is finished to shutdown
the gdbserver and close all the ports.

Press enter to shutdown gdbserver
```

Or for gdb:

```
% ./development/scripts/gdbclient.py -n com.android.contacts --setup-forwarding gdb
Redirecting gdbserver output to /tmp/gdbclient.log

file '/fast-2/allight/aosp/out/target/product/walleye/symbols/system/bin/app_process64'
directory '/fast-2/allight/aosp'
set solib-absolute-prefix /fast-2/allight/aosp/out/target/product/walleye/symbols
set solib-search-path /fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/hw:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/ssl/engines:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/drm:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/egl:/fast-2/allight/aosp/out/target/product/walleye/symbols/system/lib64/soundfx:/fast-2/allight/aosp/out/target/product/walleye/symbols/vendor/lib64/:/fast-2/allight/aosp/out/target/product/walleye/symbols/vendor/lib64/hw:/fast-2/allight/aosp/out/target/product/walleye/symbols/vendor/lib64/egl
source /fast-2/allight/aosp/development/scripts/gdb/dalvik.gdb

python

def target_remote_with_retry(target, timeout_seconds):
  import time
  end_time = time.time() + timeout_seconds
  while True:
    try:
      gdb.execute("target extended-remote " + target)
      return True
    except gdb.error as e:
      time_left = end_time - time.time()
      if time_left < 0 or time_left > timeout_seconds:
        print("Error: unable to connect to device.")
        print(e)
        return False
      time.sleep(min(0.25, time_left))

target_remote_with_retry(':5039', 5)

end

Paste the above gdb commands into the gdb frontend to setup the gdbserver
connection. Press enter in this terminal once debugging is finished to
shutdown the gdbserver and close all the ports.

Press enter to shutdown gdbserver
```

Test: ./development/scripts/gdbclient.py -n com.android.contacts --setup-forwarding vscode
      Perform debugging.

Change-Id: Ifa105cfbb100c4ba872b85c1c609d49a4f194d8b
2019-01-18 11:03:03 -08:00
Peter Collingbourne
63bf1087eb gdbclient.py: Add --env flag.
This flag allows users to set environment variables when running
a binary.

Change-Id: I01e2729c372da2e231bda86accc805495dcfdc06
2018-12-19 20:52:38 -08:00
Andreas Gampe
fa383d4beb Merge changes I37eb4151,If40a376d,Ic43b5cc6,Iaa9f304c am: 82f245e9d6 am: 9983327446
am: 0eed66500c

Change-Id: I517aee98ea9f760e866e8ad87a5acea07725e3ee
2018-10-30 14:54:32 -07:00
Andreas Gampe
e547eb3c9b Symbol: Add presubmit testing
Add symbol's unit tests to presubmit.

Test: atest python-symbol_test
Change-Id: I37eb4151365507ab2a95d7789408504cca78153c
2018-10-30 11:03:17 -07:00
Andreas Gampe
3ee240c6c3 NativeHeapDumpViewer: Add tests to presubmit
Add native_heapdump_viewer_tests to presubmit.

Test: atest python-native_heapdump_viewer_test
Change-Id: If40a376d160e774ef357d9ba2a86b40f6f7d05f0
2018-10-30 11:03:17 -07:00
Andreas Gampe
547631e12a NativeHeapDumpViewer: Python 3 compatibility
Fix some minor compat issues. Also clean up file close.

Test: native_heapdump_viewer_tests
Change-Id: Ic43b5cc61f26dd11fffe4e9b7a06056e4ed1c676
2018-10-30 11:03:17 -07:00
Andreas Gampe
9240b454cc Symbol: Python 3 compatibility
Fix some minor issues.

Test: symbol test
Change-Id: Iaa9f304c079abfc26212de8213fba38f4e311ec1
2018-10-30 11:03:17 -07:00
Mathieu Chartier
a44d913994 Merge "Prevent "index out of range" crash when addr2line aborts in between" am: 076bd27d03 am: f4b0e44285
am: 5dc39fb5a9

Change-Id: I2d890efcd38c3c7835d2eccb24265f226ac846f9
2018-10-09 10:28:22 -07:00
Mathieu Chartier
076bd27d03 Merge "Prevent "index out of range" crash when addr2line aborts in between" 2018-10-09 17:04:08 +00:00
Shibin George
7e73f7a7b4 Prevent "index out of range" crash when addr2line aborts in between
addr2line may abort and "result" may be incomplete. This leads to
"index out of range" exceptions. Enclose this in a try & except block
and on exception, default to function:location = ---:---

Test: "python native_heapdump_viewer_tests.py" (after CL:780974)
      passes.

BUG: 117306194

Change-Id: I4fd5c784949f279550aec95b68045df4a671da74
2018-10-09 06:21:03 +05:30
Shibin George
76962e13a0 Merge "native_heapdump_viewer_tests: update ParseNativeHeap() to pass 4 arguments" am: 3a5c7924a3 am: 89fc7d5d8e
am: b9f002bec8

Change-Id: If83045b7ce6f96e14a6e51722f26d7fb260321bc
2018-10-08 10:51:34 -07:00
Shibin George
b971e043f7 native_heapdump_viewer_tests: update ParseNativeHeap() to pass 4 arguments
fca3084 introduced an additional argument to ParseNativeHeap().
This CL updates the test to reflect the same.

Test: "python native_heapdump_viewer_tests.py" executes without
      any errors.

Change-Id: I6c196205ead2cb6abd4a646a3ac53e62ae3e5038
2018-10-06 03:54:13 +00:00
Joel Fernandes
9d51f4473f Merge "Remove ashmem from development repository" am: 9198f40364 am: 4ad8753727
am: 6ca70da806

Change-Id: I05030e1b2e78b4c6f453363163ae0e06740e6474
2018-08-30 13:21:03 -07:00
Joel Fernandes
ec9ee7f412 Remove ashmem from development repository
This topic removes ashmem from ART. Changes the names in development/
too. It only affects "dalvik-" ashmem regions which are the majority.

Change-Id: I1186eb60087384847892f655bec8174169ffd6c4
Signed-off-by: Joel Fernandes <joelaf@google.com>
2018-08-24 12:37:52 -07:00
Christopher Ferris
8731493c3f Merge "Handle IOExceptions if addr2line fails." am: 9a192cd10b am: 636042a889 am: 7d17c32a1a
am: 225a3c7448

Change-Id: If51cebc2b8187ef1fbe894db5ae22d4f36c091fe
2018-08-10 18:43:54 -07:00
Christopher Ferris
6fc7aefbba Handle IOExceptions if addr2line fails.
Bug: 112357697

Test: Verified that this doesn't cause any issues with a stack.
Test: Faked an exception and verified no crash.
Change-Id: I61982dbd44ac4f52b008bc35bbff2d9687f6ae25
2018-08-10 12:17:51 -07:00
Mathieu Chartier
76e11769f5 Merge "Fix GetMappingFromOffset" am: 0d2f6425ed am: 9e068aa334 am: 31a466e8f6
am: d5e817a29c

Change-Id: I5c28caeeb7f9aa80672caf509c456b1f897214e2
2018-08-03 17:29:24 -07:00
Mathieu Chartier
9e068aa334 Merge "Fix GetMappingFromOffset"
am: 0d2f6425ed

Change-Id: Ib743d58a691dbbe517f7cb4cf3ce37f7ce70000d
2018-08-03 16:34:36 -07:00
Mathieu Chartier
e3503620cd Fix GetMappingFromOffset
Fixed backward calculation of mapping offset.

Added logic to page align the data offset for uncompressed shared
objects. This fixes symbolization.

Bug: 111268230
Test: inspect native heap dump for the Camera app
Change-Id: If1af41e7265f017c1a691008309c8a002d5f588e
2018-08-03 13:26:10 -07:00
Mathieu Chartier
79a4d778f6 Merge "Add logic for replacing maps for zip files"
am: a70bf347f7

Change-Id: Icad4d96f4e083e472b59702e8b801d0e0eb4c1ff
2018-07-31 16:36:07 -07:00
Mathieu Chartier
fca30841f3 Add logic for replacing maps for zip files
For zip files, try to open the file in the current directory and
insert the files as mappings. This enables the script to pick up
embedded .so files.

Added a check to look in current directory before the symbol dir.

Added --app-symbols option to specify the directory containing the
app APK and so files.

Test: manual
Bug: 111268230

(cherry picked from commit b284c20247)

Merged-In: Id1b1f13bac78911daa6a72c35ebfadfdc9c1700f
Change-Id: Ia8d3dd64f16e1d06d929b4023292cb98a438ea3e
2018-07-31 14:24:29 -07:00
Mathieu Chartier
b284c20247 Add logic for replacing maps for zip files
For zip files, try to open the file in the current directory and
insert the files as mappings. This enables the script to pick up
embedded .so files.

Added a check to look in current directory before the symbol dir.

Added --app-symbols option to specify the directory containing the
app APK and so files.

Test: manual
Bug: 111268230
Change-Id: Id1b1f13bac78911daa6a72c35ebfadfdc9c1700f
2018-07-31 13:12:01 -07:00
Josh Gao
739452b7dd Merge "pid: switch to pgrep." am: 3aa9457410 am: 3140c7e495 am: e7e7d31b2b
am: 8ca04cddb5

Change-Id: I5e442229320fda316887c0896af7ee94f20a7f76
2018-07-23 19:14:39 -07:00