Closed
Description
Output of a session of mine:
fn factorial(x: int) -> int {
if x <= 0 { 1 } else { x * factorial(x - 1) }
}
fn main() {
let x = 4;
println!("{}", factorial(x));
}
$ rustc -g inspect.rs
$ lldb ./inspect
Current executable set to './inspect' (x86_64).
(lldb) b main
Breakpoint 1: 2 locations.
(lldb) r
Process 45203 launched: './inspect' (x86_64)
Process 45203 stopped
* thread #1: tid = 0x370ce1, 0x0000000100001780 inspect`main, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
frame #0: 0x0000000100001780 inspect`main
inspect`main:
-> 0x100001780: cmpq %gs:0x330, %rsp
0x100001789: ja 0x1000017a5 ; main + 37
0x10000178b: movabsq $0x18, %r10
0x100001795: movabsq $0x0, %r11
(lldb) c
Process 45203 resuming
Process 45203 stopped
* thread #2: tid = 0x370cf7, 0x00000001000016b4 inspect`inspect::main + 52 at inspect.rs:6, stop reason = breakpoint 1.1
frame #0: 0x00000001000016b4 inspect`inspect::main + 52 at inspect.rs:6
3 }
4
5 fn main() {
-> 6 let x = 4;
7 println!("{}", factorial(x));
8 }
(lldb) print factorial(5)
Error [IRForTarget]: Size of result type 'long (long)' couldn't be determined
error: warning: function 'factorial' has internal linkage but is not defined
note: used here
error: The expression could not be prepared to run in the target
(lldb)
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
alexcrichton commentedon Mar 13, 2014
I'm not sure if this is the fault of some debuginfo, or possibly that the default OSX lldb is a little out of date. Some other things that I did:
alexcrichton commentedon Mar 13, 2014
This may also be an lldb bug, I'm unsure
jdm commentedon Mar 13, 2014
If Rust is still dealing with return values through an outparam, DWARF does not appear to have a way to represent that. Function return values in gdb are always meaningless.
thestinger commentedon Mar 13, 2014
Rust only uses an out parameter for what it calls non-immediate types. An
int
is an immediate type.michaelwoerister commentedon Mar 14, 2014
Mind that calling functions in the debugger is explicitly not supported at the moment. This will definitely be interesting in the future but it isn't a high priority right now.
steveklabnik commentedon Apr 20, 2015
Triage: today, a different error:
brson commentedon Dec 27, 2016
Updated test
It looks to me like the paths in the debugger want to be crate-prefixed today.
Results in gdb on Ubuntu 16.04:
Results in lldb on Ubuntu 16.04:
xanlpz commentedon Mar 1, 2017
This seems to work fine with current rust?
sanmai-NL commentedon Oct 20, 2017
@alexcrichton: This appears to be fixed according to @xanlpz?
alexcrichton commentedon Oct 20, 2017
Ok!
Auto merge of rust-lang#12868 - lowr:follow-up-on-12832, r=lnicola
Auto merge of rust-lang#12868 - VitalikButerinEth:master, r=llogiq