Open rahlhar opened 2 months ago
You can use addr2line
to figure out the line of code this is crashing on:
#08 pc 00000000000096a4 /data/app/org.foo.quicktest-z63IAQZUKcj_BhprsVvQ5A==/lib/arm64/libquicktest.so
But normally you get a much more sophisticated call stack, I am surprised it's so spartan.
Also, typically people who use this just use printf/tombstones to debug, I don't know if anyone's gotten gdb working, but a guide would be cool.
Cheers. I'll try that out.
Will do some more digging as well. If I can get gdb
working, I'll definitely write something up.
Please do!
After some playing around trying to get debug symbols - had some partial luck - it looks like the crash is referencing test.c:161.
But that doesn't seem to make much sense.
Also, I say partial luck because initially addr2line
couldn't determine anything until I realised I needed to tweak the Makefile
to compile a debug build of the .so
.
But while it gives some more info, it seems wrong. I'm likely messing something up.
Since then I've been playing with the ndk's ndk-gdb.py
.
Got some success with attaching to the process both with lldb
and gdb
.
Have just now managed to get a simplified shell script version (just for gdb
) working.
It's partially automated, but relies more on some well defined environment vars than the code on which it's based.
It definitely still needs some work. I'll upload it soon in the hope anyone else will poke at it, maybe make some suggestions.
I'm now back to struggling with actually debugging the problem that started this journey. But I'm poorly experienced when it comes to debugging threaded coded, and I still haven't managed to track the source of the crash.
Well (1) Please write it up, and include it to the readme. and (2) What is your problem?
Ok, I've pushed a branch to here.
I've not yet added to the readme, but the comments in ndk-gdb.sh
should hopefully explain things for now.
After tweaking a few environment vars it should (I hope) be as simple as running:
$ make push
$ ./ndk-gdb.sh
As for my actual problem, I'm not exactly certain beyond the cnfgtest
app crashing after a second or two (SIGABRT
).
I've as yet been unable to actually pin down what exactly is raising the signal, so have no idea what the root cause might be.
I'm only now learning about what you meant earlier by tombstone debugging.
Also about not being too restrictive when running logcat
.
Sorry about that; you were right that there was a lot of detail missing from my initial log output.
This is the freshest tombstone.
I also should have mentioned that while the library name is changed, the code for cnfgtest
is otherwise unchanged.
For now I've force pushed the removal of the Makefile
changes to my gdb-support branch.
If I'm not mistaken though I did set it up so that if BUILD=RELEASE
then CFLAGS
would end up being exactly as in your original.
But I should not have included those changes in this branch anyway.
Before submitting a PR, I should probably clean up the bash script a bit.
For one, I'm not keen on the duplication of values that are already in the Makefile
.
Should I call the script via a Makefile
recipe instead so it can use the env vars set there?
Regarding the Makefile
changes - I was wrong to say "exactly" above.
If the order and/or duplication of certain values was crucial then I failed in that regard.
Order/duplication doesn't matter - any plans to open a proper PR here?
Yes. Wanted to clear some things up first, but I suppose that can be done before the PR gets merged.
PR is #87
While I will outline a specific issue being faced, I'm really mostly interested in knowing how to debug a barebones project like this.
Should we use
ndk-gdb
somehow? (From initial testing I get the feeling this is not the approach.) It throws an errorFailed to retrieve application ABI from Android.mk
.Or perhaps running
am
from anadb shell
, presumably usingset-debug-app
and-w
to wait for a debugger; then using plain oldgdb
withgdbserver
.Other?
I just wanted to get some advice if possible before I potentially go digging down some unnecessary rabbit holes.
Currently just trying to get the example code working, so I can then poke around and develop a good understanding of how things are working.
Sideloading onto a device using Android 10 (API 29).
Can get the demo to startup on the device, I see a couple of seconds of content, then it crashes.
logcat
yields the following (with the errors singled out). The standout error being: