Skip to content
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

rust-lldb: fix crash when printing empty string #58629

Merged
merged 1 commit into from
Mar 9, 2019

Conversation

euclio
Copy link
Contributor

@euclio euclio commented Feb 22, 2019

Fixes #52185.

Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 22, 2019
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:29dee5c6:start=1550798865224776861,finish=1550798866250241594,duration=1025464733
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:13:16] 
[01:13:16] running 119 tests
[01:13:45] .iiiii...i.....i..i...i..i.i..i.ii...i.....i..i....i..........iiii..........i...iF...i.......ii.i.i. 100/119
[01:13:50] i......iii.i.....ii
[01:13:50] 
[01:13:50] ---- [debuginfo-both] debuginfo/pretty-std.rs stdout ----
[01:13:50] ---- [debuginfo-both] debuginfo/pretty-std.rs stdout ----
[01:13:50] NOTE: compiletest thinks it is using GDB without native rust support
[01:13:50] NOTE: compiletest thinks it is using GDB version 7011001
[01:13:50] 
[01:13:50] error: line not found in debugger output: $5 = core::option::Option<i16>::Some(8)
[01:13:50] status: exit code: 0
[01:13:50] command: "/usr/bin/gdb" "-quiet" "-batch" "-nx" "-command=/checkout/obj/build/x86_64-unknown-linux-gnu/test/debuginfo/pretty-std/pretty-std.debugger.script"
[01:13:50] ------------------------------------------
[01:13:50] GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
[01:13:50] Copyright (C) 2016 Free Software Foundation, Inc.
[01:13:50] Copyright (C) 2016 Free Software Foundation, Inc.
[01:13:50] License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[01:13:50] This is free software: you are free to change and redistribute it.
[01:13:50] There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[01:13:50] and "show warranty" for details.
[01:13:50] This GDB was configured as "x86_64-linux-gnu".
[01:13:50] Type "show configuration" for configuration details.
[01:13:50] For bug reporting instructions, please see:
[01:13:50] <http://www.gnu.org/software/gdb/bugs/>.
[01:13:50] Find the GDB manual and other documentation resources online at:
[01:13:50] <http://www.gnu.org/software/gdb/documentation/>.
[01:13:50] For help, type "help".
[01:13:50] Type "apropos word" to search for commands related to "word".
[01:13:50] Breakpoint 1 at 0x31a3: file /checkout/src/test/debuginfo/pretty-std.rs, line 100.
[01:13:50] [Thread debugging using libthread_db enabled]
[01:13:50] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[01:13:50] 
[01:13:50] Breakpoint 1, pretty_std::main::hd868472729f88994 () at /checkout/src/test/debuginfo/pretty-std.rs:100
[01:13:50] 100     zzz(); // #break
[01:13:50] $1 = &[i32](len: 4) = {0, 1, 2, 3}
[01:13:50] $2 = Vec<u64>(len: 4, cap: 4) = {4, 5, 6, 7}
[01:13:50] $3 = "IAMA string slice!"
[01:13:50] $4 = "IAMA string!"
[01:13:50] $5 = Some = {8}
[01:13:50] $6 = None
[01:13:50] $7 = "IAMA OS string \360\237\230\203"
[01:13:50] $8 = {RUST$ENCODED$ENUM$0$None = Some = {"IAMA optional string!"}}
[01:13:50] $9 = {RUST$ENCODED$ENUM$0$None = Some = {"IAMA "...}}
[01:13:50] $10 = ""
[01:13:50] A debugging session is active.
[01:13:50] 
[01:13:50]  Inferior 1 [process 761] will be killed.
[01:13:50] 
[01:13:50] Quit anyway? (y or n) [answered Y; input not from terminal]
[01:13:50] ------------------------------------------
[01:13:50] stderr:
[01:13:50] ------------------------------------------
[01:13:50] ------------------------------------------
[01:13:50] Python Exception <class 'gdb.error'> Cannot convert value to long.: 
[01:13:50] Python Exception <class 'gdb.error'> Cannot convert value to long.: 
[01:13:50] Python Exception <class 'gdb.error'> Cannot convert value to long.: 
[01:13:50] Python Exception <class 'gdb.error'> Cannot convert value to long.: 
[01:13:50] ------------------------------------------
[01:13:50] 
[01:13:50] thread 'main' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
[01:13:50] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
---
[01:13:50] 
[01:13:50] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:496:22
[01:13:50] 
[01:13:50] 
[01:13:50] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/debuginfo" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/debuginfo" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "debuginfo-both" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:13:50] 
[01:13:50] 
[01:13:50] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:13:50] Build completed unsuccessfully in 0:12:48
[01:13:50] Build completed unsuccessfully in 0:12:48
[01:13:50] make: *** [check] Error 1
[01:13:50] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:13d41035
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Fri Feb 22 02:41:47 UTC 2019
---
travis_time:end:1f653120:start=1550803309094310077,finish=1550803309153947276,duration=59637199
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:36499595
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0015bd3a
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@alexcrichton
Copy link
Member

@bors: r+

cc @michaelwoerister (in case you'd like to double check)

@bors
Copy link
Contributor

bors commented Feb 22, 2019

📌 Commit 7c74bac has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 22, 2019
Centril added a commit to Centril/rust that referenced this pull request Feb 24, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).
@Centril
Copy link
Contributor

Centril commented Feb 24, 2019

Probably failed in #58688 (comment), @bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 24, 2019
@euclio
Copy link
Contributor Author

euclio commented Feb 25, 2019

Ok, since the pretty-std test looks like it's pretty flaky, I reverted the changes I made to it and extracted the empty string tests into their own file.

@Centril
Copy link
Contributor

Centril commented Feb 25, 2019

r? @alexcrichton

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Feb 25, 2019

📌 Commit b7d4f96 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 25, 2019
Centril added a commit to Centril/rust that referenced this pull request Feb 25, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Mar 1, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
@bors
Copy link
Contributor

bors commented Mar 3, 2019

⌛ Testing commit 932fe17 with merge 2b7bcefa602313686484007e88a31a25647bfe13...

@bors
Copy link
Contributor

bors commented Mar 3, 2019

💔 Test failed - checks-travis

@rust-highfive
Copy link
Collaborator

The job arm-android of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[01:42:09] 
[01:42:09] failures:
[01:42:09] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:496:22
[01:42:09] 
[01:42:09] ---- [debuginfo-both] debuginfo/empty-string.rs stdout ----
[01:42:09] NOTE: compiletest thinks it is using GDB without native rust support
[01:42:09] 
[01:42:09] error: line not found in debugger output: $1 = ""
[01:42:09] status: exit code: 0
[01:42:09] command: "arm-linux-androideabi-gdb" "-quiet" "-batch" "-nx" "-command=/checkout/obj/build/x86_64-unknown-linux-gnu/test/debuginfo/empty-string/empty-string.debugger.script"
[01:42:09] ------------------------------------------
[01:42:09] ------------------------------------------
[01:42:09] 0xb6fe1a30 in ?? ()
[01:42:09] Breakpoint 1 at 0xb6ff4560: file /checkout/src/test/debuginfo/empty-string.rs, line 31.
[01:42:09] 
[01:42:09] Breakpoint 1, empty_string::main::h2741c6f3b053ffe9 () at /checkout/src/test/debuginfo/empty-string.rs:31
[01:42:09] 31     zzz(); // #break
[01:42:09] $1 = {vec = {buf = {ptr = {pointer = 0x1 <error: Cannot access memory at address 0x1>, _marker = {<No data fields>}}, cap = 0, a = {<No data fields>}}, len = 0}}
[01:42:09] $2 = {data_ptr = 0xb6ff4d09 "", length = 0}
[01:42:09] A debugging session is active.
[01:42:09] 
[01:42:09]  Inferior 1 [process 22290] will be killed.
[01:42:09] 
[01:42:09] Quit anyway? (y or n) [answered Y; input not from terminal]
[01:42:09] ------------------------------------------
[01:42:09] stderr:
[01:42:09] ------------------------------------------
[01:42:09] ------------------------------------------
[01:42:09] warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
[01:42:09] of file /checkout/obj/build/x86_64-unknown-linux-gnu/test/debuginfo/empty-string/a.
[01:42:09] Use `info auto-load python-scripts [REGEXP]' to list them.
[01:42:09] warning: Unable to find dynamic linker breakpoint function.
[01:42:09] GDB will be unable to debug shared library initializers
[01:42:09] and track explicitly loaded dynamic code.
[01:42:09] warning: Unable to find dynamic linker breakpoint function.
[01:42:09] GDB will be unable to debug shared library initializers
[01:42:09] and track explicitly loaded dynamic code.
[01:42:09] warning: Could not load shared library symbols for 4 libraries, e.g. /system/bin/linker.
[01:42:09] Use the "info sharedlibrary" command to see the complete listing.
[01:42:09] Do you need "set solib-search-path" or "set sysroot"?
[01:42:09] ------------------------------------------
[01:42:09] 
[01:42:09] thread 'main' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
[01:42:09] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
---
[01:42:09] test result: FAILED. 71 passed; 1 failed; 48 ignored; 0 measured; 0 filtered out
[01:42:09] 
[01:42:09] 
[01:42:09] 
[01:42:09] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/arm-linux-androideabi/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/debuginfo" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/debuginfo" "--stage-id" "stage2-arm-linux-androideabi" "--mode" "debuginfo-both" "--target" "arm-linux-androideabi" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--linker" "/android/ndk/arm-14/bin/arm-linux-androideabi-clang" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/arm-linux-androideabi/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--llvm-version" "8.0.0\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--remote-test-client" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/remote-test-client" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "/android/ndk/arm-14" "--color" "always"
[01:42:09] 
[01:42:09] 
[01:42:09] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target arm-linux-androideabi
[01:42:09] Build completed unsuccessfully in 1:31:55
---
travis_time:end:011d8106:start=1551631444246113397,finish=1551631444253938006,duration=7824609
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0ba7c890
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:18fece40
travis_time:start:18fece40
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:010bc52a
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 3, 2019
@euclio
Copy link
Contributor Author

euclio commented Mar 6, 2019

Amended the commit to ignore android as well.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 6, 2019

📌 Commit 9e5def9 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Mar 6, 2019

🌲 The tree is currently closed for pull requests below priority 50, this pull request will be tested once the tree is reopened

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 6, 2019
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this pull request Mar 9, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
bors added a commit that referenced this pull request Mar 9, 2019
Rollup of 13 pull requests

Successful merges:

 - #58518 (Use early unwraps instead of bubbling up errors just to unwrap in the end)
 - #58626 (rustdoc: add option to calculate "documentation coverage")
 - #58629 (rust-lldb: fix crash when printing empty string)
 - #58660 (MaybeUninit: add read_initialized, add examples)
 - #58670 (fixes #52482)
 - #58676 (look for python2 symlinks before bootstrap python)
 - #58679 (Refactor passes and pass execution to be more parallel)
 - #58750 (Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const)
 - #58762 (Mention `unwind(aborts)` in diagnostics for `#[unwind]`)
 - #58924 (Add as_slice() to slice::IterMut and vec::Drain)
 - #58990 (Actually publish miri in the manifest)
 - #59018 (std: Delete a by-definition spuriously failing test)
 - #59045 (Expose new_sub_parser_from_file)

Failed merges:

r? @ghost
@bors bors merged commit 9e5def9 into rust-lang:master Mar 9, 2019
@euclio euclio deleted the debug-empty-str branch March 9, 2019 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants