-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc++][PowerPC] libcxx/gdb/gdb_pretty_printer_test.sh.cpp LIT test case failure on LLVM 13 #51017
Comments
Interestingly, I found this test fails for us on Ubuntu as well, although in a different way. It looks like there is a Python error, but the return code is 0 so the testing didn't initially report that there is a test failure. $ /usr/bin/gdb -nx -batch -iex "set autoload off" -ex "source /data/amyk/llvm_trunk/llvm-project/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py" -ex "python register_libcxx_printer_loader()" -ex "source /data/amyk/llvm_trunk/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py" /data/amyk/llvm_trunk/rel13/projects/libcxx/test/libcxx/gdb/Output/gdb_pretty_printer_test.sh.cpp.dir/t.tmp.exe $ echo $? According to https://sourceware.org/gdb/current/onlinedocs/gdb/Breakpoints-In-Python.html#Breakpoints-In-Python, 'commands' should definitely be writable... |
Louis, do you happen to have any knowledge on what could be going on with either of these issues? |
In terms of the "AttributeError: attribute 'commands' of 'gdb.Breakpoint' objects is not writable" error seen on the Ubuntu machine I was testing on, it seems like this maybe related to the version of GDB that is on the system. It looks like GDB 8.2 allows If I use a GDB 8.2, I see the same failure on Ubuntu that I originally reported on RHEL (with the test failing 82 cases). |
Within libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp, it looks like the commented out tests are the ones that fail and have the "value has been optimized out" messages: . . . int main(int, char**) { // string_test(); // u32string_test(); For instance, if I look only
(gdb) p value (gdb) stepi (gdb) p value |
I've added Sterling Augustine to this Bugzilla in case Sterling has any insight of what might be going on. I believe Sterling has contributed to the gdb pretty printers test case in the past. I am not sure if this is expected, but I've also tried to wrap the variable in a MarkAsLive call: diff --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp void string_test() {
Although, this doesn't seem to prevent any variables from being optimized out. |
My full compile command looks like: $ clang++ -v --gcc-toolchain=/usr --target=powerpc64le-unknown-linux-gnu /home/amyk/llvm/upstream/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp -o /home/amyk/llvm/upstream/build/projects/libcxx/test/libcxx/gdb/Output/gdb_pretty_printer_test.sh.cpp.dir/t.tmp.exe -include /home/amyk/llvm/upstream/llvm-project/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/amyk/llvm/upstream/build/include/c++/v1 -I/home/amyk/llvm/upstream/build/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/amyk/llvm/upstream/llvm-project/libcxx/test/support -std=c++20 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -g -lc++experimental -L/home/amyk/llvm/upstream/build/./lib -Wl,-rpath,/home/amyk/llvm/upstream/build/./lib -L/home/amyk/llvm/upstream/build/./lib -Wl,-rpath,/home/amyk/llvm/upstream/build/./lib -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic And while I'm looking at string_test() specifically, it's run as: $ /usr/bin/gdb -nx -batch -iex "set autoload off" -ex "source /home/amyk/llvm/upstream/llvm-project/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py" -ex "python register_libcxx_printer_loader()" -ex "source /home/amyk/llvm/upstream/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py" /home/amyk/llvm/upstream/build/projects/libcxx/test/libcxx/gdb/Output/gdb_pretty_printer_test.sh.cpp.dir/t.tmp.exe I'm seeing it failing right when it prints the value at: s = gdb.execute("p value", to_string=True) inside libcxx/gdb/gdb_pretty_printer_test.py. |
I don't know exactly what is going on here, but gdb's "Value has been optimized out" error message is often misleading. Sometimes it prints it when it just can't find a symbol, sometimes when it can find a symbol but the pc is inside a range that isn't covered by the location list, or some other situation. So the term, "optimized out" isn't quite right. It should more properly read something like, "can't find debug info for symbol at pc. Maybe it was optimized out, but maybe something else." The test itself does take steps to prevent optimizing the local variables--they are passed as arguments into functions that have optimization turned off, and these arguments are the ones that are actually pretty printed, rather than the local variables down in the tests functions themselves, so I wouldn't expect the MarkAsLive change as given here to affect anything. My guess is that the debug info is slightly different than what it should be. Perhaps the dwarf range for value is off by one instruction or similar? |
Thanks for your response, Sterling. The issue very well could be something debug info related. I was also experimenting and found that adding diff --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
template void ComparePrettyPrintToRegex(
void CompareExpressionPrettyPrintToChars(
void CompareExpressionPrettyPrintToRegex(
This compiles and runs successfully: $ clang++ --gcc-toolchain=/usr --target=powerpc64le-unknown-linux-gnu /home/amyk/llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp -o /home/amyk/llvm/dev/build/projects/libcxx/test/libcxx/gdb/Output/gdb_pretty_printer_test.sh.cpp.dir/t.tmp.exe -include /home/amyk/llvm/dev/llvm-project/libcxx/test/support/nasty_macros.h -nostdinc++ -I/home/amyk/llvm/dev/build/include/c++/v1 -I/home/amyk/llvm/dev/build/projects/libcxx/include/c++build -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -I/home/amyk/llvm/dev/llvm-project/libcxx/test/support -std=c++20 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -g -lc++experimental -L/home/amyk/llvm/dev/build/./lib -Wl,-rpath,/home/amyk/llvm/dev/build/./lib -L/home/amyk/llvm/dev/build/./lib -Wl,-rpath,/home/amyk/llvm/dev/build/./lib -nodefaultlibs -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic $ /usr/bin/gdb -nx -batch -iex "set autoload off" -ex "source /home/amyk/llvm/dev/llvm-project/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py" -ex "python register_libcxx_printer_loader()" -ex "source /home/amyk/llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py" /home/amyk/llvm/dev/build/projects/libcxx/test/libcxx/gdb/Output/gdb_pretty_printer_test.sh.cpp.dir/t.tmp.exe . . . PASS: /home/amyk/llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:647 I was wondering if this is an appropriate change for gdb_pretty_printer_test.sh.cpp? |
I'm puzzled that it is necessary. Passing the value to an OPT_NONE function should work, and does most everyone. But it is also harmless, so I think this change is OK. |
Yeah, I agree. |
Fixed on main and cherry-picked to release/13.x as commit 1c3fcc8 (HEAD -> release/13.x)
Thanks a lot! |
Extended Description
The gdb_pretty_printer_test.sh.cpp was recently enabled to run on PowerPC since this commit:
commit 6427c53
Author: Louis Dionne ldionne.2@gmail.com
Date: Wed Mar 24 16:45:55 2021 -0400
I happen to test on one of our RHEL 8.2 machines, and the following behaviour of this test occurs during run time:
$ "/usr/bin/gdb" "-nx" "-batch" "-iex" "set autoload off" "-ex" "source /home/amyk/llvm/dev/llvm-project/libcxx/test/libcxx/gdb/../../../utils/gdb/libcxx/printers.py" "-ex" "python register_libcxx_printer_loader()" "-ex" "source /home/amyk/llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py" "/home/amyk/llvm/dev/build/projects/libcxx/test/libcxx/gdb/Output/gdb_pretty_printer_test.sh.cpp.dir/t.tmp.exe"
No symbol table is loaded. Use the "file" command.
Breakpoint 1 at 0x10002968: file llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp, line 67.
Loading libc++ pretty-printers.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/power9/libthread_db.so.1".
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:170
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:174
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:179
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:184
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:217
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:222
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:243
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:246
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:249
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:257
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
FAIL: Something is wrong in the test framework.
value has been optimized out
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:603
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:639
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:643
PASS: llvm/dev/llvm-project/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp:648
[Inferior 1 (process 708433) exited normally]
FAILED 82 cases
Investigation is ongoing...
The text was updated successfully, but these errors were encountered: