On Tue, Mar 25, 2025 at 9:46 AM John Dallman <
jgdats...@gmail.com> wrote:
>
> On Tue, Mar 25, 2025 at 12:41 PM 'enh' via android-ndk
> <
andro...@googlegroups.com> wrote:
> > are you sure it's actually making it through? because that error is
> > the exact error you'd see if it wasn't.
>
> Indeed. I tried the workaround in that Stack Overflow question, by running:
>
> (lldb) platform shell LD_LIBRARY_PATH=/data/local/tmp
> (lldb) platform shell echo $LD_LIBRARY_PATH
> /data/local/tmp
>
> before saying "run" to the debugger, but I get exactly the same error.
i'm assuming there's no selinux domain transition or similar going on
here? (LD_LIBRARY_PATH is on the list of unsafe environment variables
that the dynamic linker clears if AT_SECURE is set.)
if you have
https://android-review.googlesource.com/c/platform/bionic/+/3250573
(which basically means "you're running a developer preview/beta of
this year's release") you have an LD_DEBUG environment variable
similar in use to the glibc one (and use LD_DEBUG=help for more
information). anything older and you're stuck with a fairly
inscrutable integer, but you can try setting that to increasingly high
numbers until you see where it's searching for things. (note though
that LD_DEBUG is also on the AT_SECURE blacklist.)
(i didn't realize until looking for a link just now that LD_DEBUG is
undocumented.
https://android-review.googlesource.com/c/platform/bionic/+/3560463
addresses that.)
> > as a hack, stick a sleep() or getchar() in the start of your main, run
> > it normally, and then attach to the running process by pid.
> >
> > as an alternative hack, debug a static binary.
>
> I'll try those after pulling a complete repro case together.
>
> I am not doing any kind of initialisation of NDK variables, just
> setting PATH to include some of its directories. Could that be a
> problem?
i'm not aware that we have any custom changes to lldb.
> To view this discussion visit
https://groups.google.com/d/msgid/android-ndk/CAH1xqg%3Dywok06PRt3EOqAshaKdXr7q9pPH%2B3tBPK5yp0JzG4Pg%40mail.gmail.com.