-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
LLDB show variable 'res' (when stepping at line 12) that does not exists in the code.
$ cat -n a.rs
1 // run-pass
2 use std::ptr;
3 use std::rc::Rc;
4 use std::sync::Arc;
5
6 fn main() {
7 let p: *const u8 = ptr::null();
8 let rc = Rc::new(1usize);
9 let arc = Arc::new(1usize);
10 let b = Box::new("hi");
11
12 let _ = format!("{:p}{:p}{:p}",
13 rc, arc, b);
14
15 if cfg!(target_pointer_width = "32") {
16 assert_eq!(format!("{:#p}", p),
17 "0x00000000");
18 } else {
19 assert_eq!(format!("{:#p}", p),
20 "0x0000000000000000");
21 }
22 assert_eq!(format!("{:p}", p),
23 "0x0");
24 }
$ cat a.rs
// run-pass
use std::ptr;
use std::rc::Rc;
use std::sync::Arc;
fn main() {
let p: *const u8 = ptr::null();
let rc = Rc::new(1usize);
let arc = Arc::new(1usize);
let b = Box::new("hi");
let _ = format!("{:p}{:p}{:p}",
rc, arc, b);
if cfg!(target_pointer_width = "32") {
assert_eq!(format!("{:#p}", p),
"0x00000000");
} else {
assert_eq!(format!("{:#p}", p),
"0x0000000000000000");
}
assert_eq!(format!("{:p}", p),
"0x0");
}
$ rustc --version
+rustc 1.46.0-nightly (3503f565e 2020-07-02)
$ lldb -v
lldb version 11.0.0
clang revision ee26a31e7b02e124d71091d47f2ae624774e5e0a
llvm revision ee26a31e7b02e124d71091d47f2ae624774e5e0a
$ rustc -g -C opt-level=1 -o opt a.rs
$ lldb opt
lldb opt
(lldb) target create "opt"
Current executable set to 'opt' (x86_64).
(lldb) b -l 12
Breakpoint 1: 2 locations.
(lldb) r
Process 62 launched: 'opt' (x86_64)
Process 62 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
frame #0: 0x00005555555590f6 opt`a::main::h1122ef72fcd4218b at a.rs:12:13
9 let arc = Arc::new(1usize);
10 let b = Box::new("hi");
11
-> 12 let _ = format!("{:p}{:p}{:p}",
13 rc, arc, b);
14
15 if cfg!(target_pointer_width = "32") {
(lldb) frame var
(unsigned char *) p = <empty constant data>
(alloc::rc::Rc<unsigned long>) rc = <variable not available>
(alloc::sync::Arc<unsigned long>) arc = <variable not available>
(&str *) b = 0x000055555578fa80
(lldb) c
Process 62 resuming
Process 62 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.2
frame #0: 0x000055555555918f opt`a::main::h1122ef72fcd4218b at a.rs:12:13
9 let arc = Arc::new(1usize);
10 let b = Box::new("hi");
11
-> 12 let _ = format!("{:p}{:p}{:p}",
13 rc, arc, b);
14
15 if cfg!(target_pointer_width = "32") {
(lldb) frame var
(unsigned char *) p = <empty constant data>
(alloc::rc::Rc<unsigned long>) rc = <variable not available>
(alloc::sync::Arc<unsigned long>) arc = <variable not available>
(&str *) b = <variable not available>
(alloc::string::String) res = {
vec = {
buf = {
ptr = (pointer = "0x55555578fa500x55555578fa700x55555578fa80\U00000002", _marker = core::marker::PhantomData<unsigned char> @ 0x00007fffffffe290)
Metadata
Metadata
Assignees
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.