今日明日やっている河野先生のコンパイラ読み会で今年はRustを読んでいるけれど、rust-lldbはどうもrust compilerレベルの巨大なプロジェクトのデバッグは微妙っぽい。
どうも見たら公式がNone of the LLDB work is upstream. This rust-lang/lldb wiki page explains a few details.とか言っている。おいおい。。。LLVM backendなので逆にlldbの方使ってそうなのに。
関数名でbreakpointを貼るいつものオペレーションも、pubなものは
b rustc_interface::passes::parse
みたいにbreakpointを貼れるけど、例えばimpl
している中で定義している関数の場合は
(gdb) b parse_fn_ rustc_parse::parser::expr::<impl rustc_parse::parser::Parser>::parse_fn_block_param rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_fn_decl rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_fn_front_matter rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_fn_params::{{closure}} (gdb) b parse_fn_body
の様に <>
にimplの型名をいれないと捕獲できず、さらにpubでないものはbreak pointを上手く貼れないっぽい。
一応回避策として、例えばrustc_parseのparser::iterm::parse_fn_bodyにbreak pointを貼るときはb item.rs:1535
の様に直接行番号を指定すればいいっぽい。ただこれも止まらないケースがあるのでわりかし微妙っぽい。