Brillo开发: brillo-m9-dev分支gdb debug问题

在brillo-m9-dev分支下使用gdb debug的时候,可能会出来如下问题:

hzak@B85PRO:/local/brillo-m9-dev$ tools/bdk/debugging/gdbclient.py -p 993
Traceback (most recent call last):
  File "tools/bdk/debugging/gdbclient.py", line 270, in <module>
    main()
  File "tools/bdk/debugging/gdbclient.py", line 230, in main
    binary_file, pid, run_cmd = handle_switches(args, sysroot)
  File "tools/bdk/debugging/gdbclient.py", line 144, in handle_switches
    user=args.user)
  File "/local/brillo-m9-dev/tools/bdk/debugging/gdbrunner/__init__.py", line 246, in find_binary
    return find_file(device, "/proc/{}/exe".format(pid), sysroot, user)
  File "/local/brillo-m9-dev/tools/bdk/debugging/gdbrunner/__init__.py", line 238, in find_file
    for path, found_locally in generate_files():
  File "/local/brillo-m9-dev/tools/bdk/debugging/gdbrunner/__init__.py", line 234, in generate_files
    "device".format(executable_path))
RuntimeError: Failed to copy '/proc/993/exe' to temporary folder on device

这时,可以暂时使用brillo-m8-dev分支上的debuggerd代码,具体做法如下:

$ pushd system/core/debuggerd
$ rm -r *
$ git checkout aosp/brillo-m8-dev .
$ sed -i -e 's/^\(include.*NATIVE_TEST.*\)/#\1/g' Android.mk
$ mm && m snod
$ popd

之后,就可以用gdb debug了:

$ tools/bdk/debugging/gdbclient.py -p 993
WARNING:root:couldn't find /local/brillo-m9-rpi/development/scripts/gdb/dalvik.gdb - ART debugging options will not be available
GNU gdb (GDB) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Failed to read a valid object file image from memory.
libwebserv::Server::ConnectToServerViaDBus(scoped_refptr<dbus::Bus> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, base::Callback<void (bool)> const&, base::Callback<void ()> const&, base::Callback<void ()> const&) (bus=..., 
    service_name=..., cb=..., on_server_online=..., on_server_offline=...) at system/webservd/libwebserv/server.cc:29

NOTE:

使用gdb之前,要先设置system property: debug.debuggerd.wait_for_gdb为true:

$ adb shell setprop debug.debuggerd.wait_for_gdb true

 

评论

1 Comment on "Brillo开发: brillo-m9-dev分支gdb debug问题"

提醒我
avatar

356688
游客
2 年 3 月 之前

It’s not bad

wpDiscuz