You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scp libs/armeabi-v7a/ndk-r11-clang-SIGSEGV device: where device is a target Android phone with a running SSH server, e.g. SSHDroid
ssh into device and launch the program which crashes with SIGSEGV
Remote debugging gave me the following output:
(gdb) target remote 192.168.26.169:2345
Remote debugging using 192.168.26.169:2345
warning: Architecture rejected target-supplied description
Reading /data/data/berserker.android.apps.sshdroid/home/ndk-r11-clang-SIGSEGV from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /data/data/berserker.android.apps.sshdroid/home/ndk-r11-clang-SIGSEGV from remote target...
Reading symbols from target:/data/data/berserker.android.apps.sshdroid/home/ndk-r11-clang-SIGSEGV...done.
Reading /system/bin/linker from remote target...
Reading /system/bin/linker from remote target...
Reading symbols from target:/system/bin/linker...(no debugging symbols found)...done.
0x40003700 in _start () from target:/system/bin/linker
(gdb) continue
Continuing.
Program received signal SIGSEGV, Segmentation fault.
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (this=0xbeffe6d0, __str=...)
at /Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-42939/build-gnustl/static-armeabi-v7a-hardthumb-4.9/include/bits/basic_string.tcc:173
173 /Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-42939/build-gnustl/static-armeabi-v7a-hardthumb-4.9/include/bits/basic_string.tcc: No such file or directory.
(gdb) bt
#0 std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (this=0xbeffe6d0, __str=...)
at /Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-42939/build-gnustl/static-armeabi-v7a-hardthumb-4.9/include/bits/basic_string.tcc:173
#1 0x000182e0 in testing::internal::CodeLocation::CodeLocation (this=0x0) at ./gtest/gtest.h:8239
#2 testing::internal::MakeAndRegisterTestInfo (test_case_name=<optimized out>, name=<optimized out>, type_param=0x0,
value_param=0x8f2fc "DSLTest1/DSLTest", code_location=..., fixture_class_id=0x8f4fd, set_up_tc=0x8f2fc, tear_down_tc=0x0, factory=0xbeffe828)
at ./gtest/gtest-all.cc:4003
#3 0x0000e33c in testing::internal::ParameterizedTestCaseInfo<(anonymous namespace)::DSLTest>::RegisterTests (this=<optimized out>)
at ./gtest/gtest.h:11629
#4 0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
When changing the STL for c++_static it also ends up crashing in the copy constructor of basic_string.
When step debugging, I noticed that gtest captures code location information in its CodeLocation struct that captures file names by value in a std::string...
struct CodeLocation {
CodeLocation(const string& a_file, int a_line) : file(a_file), line(a_line) {}
string file;
int line;
};
While debugging, I deciphered the broken std::string instance passed to the copy constructor comes from gtest.h:11634:
That code_location_ member variable gets passed by value and when arriving in the MakeAndRegisterTestInfo() implementation in gtest-all.cc:4004 the code_location parameter's .file member variable contains garbage.
patch gtest and capture file location with a string literal so that it stops happily copying around instances of std::string
compile with -fno-omit-frame-pointer¯\_(ツ)_/¯
I also noticed it has to do with unions used in the code (I know the repro code looks strange, it's the result of spending hours reducing and debugging until I can come up with an well articulated bug repro I can share).
The text was updated successfully, but these errors were encountered:
Hello,
I'm facing a crash which I suppose is caused by a codegen bug:
NDK_TOOLCHAIN_VERSION=clang
APP_ABI=armeabi-v7a-hard
APP_OPTIM=release
APP_STL=gnustl_static
I reproduced the
SIGSEGV
withclang version 3.8.243773
shipped withndk-r11c
but bothndk-r11
andndk-r11b
are affected.Steps to reproduce:
ndk-r11-clang-SIGSEGV
repro case: ndk-r11-clang-SIGSEGV.zipcd
to directory/opt/android-ndk-r11c/ndk-build NDK_APPLICATION_MK=./Application.mk NDK_PROJECT_PATH=.
scp libs/armeabi-v7a/ndk-r11-clang-SIGSEGV device:
wheredevice
is a target Android phone with a running SSH server, e.g.SSHDroid
ssh
into device and launch the program which crashes withSIGSEGV
Remote debugging gave me the following output:
basic_string.tcc:173
is:When changing the STL for
c++_static
it also ends up crashing in the copy constructor ofbasic_string
.When step debugging, I noticed that
gtest
captures code location information in itsCodeLocation
struct that captures file names by value in astd::string
...While debugging, I deciphered the broken
std::string
instance passed to the copy constructor comes fromgtest.h:11634
:That
code_location_
member variable gets passed by value and when arriving in theMakeAndRegisterTestInfo()
implementation ingtest-all.cc:4004
thecode_location
parameter's.file
member variable contains garbage.Workarounds found so far:
gtest
and capture file location with a string literal so that it stops happily copying around instances ofstd::string
-fno-omit-frame-pointer
¯\_(ツ)_/¯
I also noticed it has to do with
unions
used in the code (I know the repro code looks strange, it's the result of spending hours reducing and debugging until I can come up with an well articulated bug repro I can share).The text was updated successfully, but these errors were encountered: