android / ndk

The Android Native Development Kit
1.96k stars 254 forks source link

include dalvik.gdb in NDK (and use it in ndk-gdb) #637

Open rprichard opened 6 years ago

rprichard commented 6 years ago

Refiled from internal issue http://b/23715351:

without this, debugging stuff with art is a PITA:

https://android.googlesource.com/platform/development/+/73cd247e450dc8732a22dbd4bff95c18bfc968ac/scripts/gdb/dalvik.gdb#16

DanAlbert commented 6 years ago

Actually this should be really simple and doable in r17, right?

rprichard commented 6 years ago

Including dalvik.gdb is easy.

Something needs to be done with ndk-gdb, because that script assumes the pre-Studio Android project + ndk-build. It doesn't work with either CMake and/or Gradle projects.

DanAlbert commented 6 years ago

Yeah, worth filing a bug to track the latter, but we can at least get dalvik.gdb into r17.

rprichard commented 5 years ago

For dalvik.gdb's art-on to work, we need to pull libart.so from the device, but it won't be there on Jelly Bean, so I'll check whether it exists before pulling it.

The existence of /system/lib[64]/libart.so doesn't imply the use of ART (instead of Dalvik) on older devices, so I suppose we'll need to detect whether ART is in use. Maybe something like if &art_sigsegv_fault != 0?

Apparently the art_sigsegv_fault breakpoint method isn't reliable until P because it can be inlined: (http://b/77528455, and maybe http://b/77492857 too)

enh commented 5 years ago

maybe until we can do all the support work, we should just have some docs somewhere pointing to the platform dalvik.gdb and recommending it?