@@ -299,16 +299,16 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine(
299299// The goal is to give users helpful live variable hints alongside the
300300// disassembled instruction stream, similar to how debug information
301301// enhances source-level debugging.
302- std::vector<std::string>
303- VariableAnnotator::annotate (Instruction &inst, Target &target,
304- const lldb::ModuleSP &module_sp) {
302+ std::vector<std::string> VariableAnnotator::Annotate (Instruction &inst) {
305303 std::vector<std::string> events;
306304
305+ auto module_sp = inst.GetAddress ().GetModule ();
306+
307307 // If we lost module context, everything becomes <undef>.
308308 if (!module_sp) {
309- for (const auto &KV : Live_ )
309+ for (const auto &KV : m_live_vars )
310310 events.emplace_back (llvm::formatv (" {0} = <undef>" , KV.second .name ).str ());
311- Live_ .clear ();
311+ m_live_vars .clear ();
312312 return events;
313313 }
314314
@@ -319,13 +319,13 @@ VariableAnnotator::annotate(Instruction &inst, Target &target,
319319 if (!module_sp->ResolveSymbolContextForAddress (iaddr, mask, sc) ||
320320 !sc.function ) {
321321 // No function context: everything dies here.
322- for (const auto &KV : Live_ )
322+ for (const auto &KV : m_live_vars )
323323 events.emplace_back (llvm::formatv (" {0} = <undef>" , KV.second .name ).str ());
324- Live_ .clear ();
324+ m_live_vars .clear ();
325325 return events;
326326 }
327327
328- // Collect in-scope variables for this instruction into Current .
328+ // Collect in-scope variables for this instruction into current_vars .
329329 VariableList var_list;
330330 // Innermost block containing iaddr.
331331 if (Block *B = sc.block ) {
@@ -341,15 +341,15 @@ VariableAnnotator::annotate(Instruction &inst, Target &target,
341341 const lldb::addr_t func_file = sc.function ->GetAddress ().GetFileAddress ();
342342
343343 // ABI from Target (pretty reg names if plugin exists). Safe to be null.
344- lldb::ABISP abi_sp = ABI::FindPlugin (nullptr , target. GetArchitecture ());
344+ lldb::ABISP abi_sp = ABI::FindPlugin (nullptr , module_sp-> GetArchitecture ());
345345 ABI *abi = abi_sp.get ();
346346
347347 llvm::DIDumpOptions opts;
348348 opts.ShowAddresses = false ;
349349 // Prefer "register-only" output when we have an ABI.
350350 opts.PrintRegisterOnly = static_cast <bool >(abi_sp);
351351
352- llvm::DenseMap<lldb::user_id_t , VarState> Current ;
352+ llvm::DenseMap<lldb::user_id_t , VarState> current_vars ;
353353
354354 for (size_t i = 0 , e = var_list.GetSize (); i != e; ++i) {
355355 lldb::VariableSP v = var_list.GetVariableAtIndex (i);
@@ -376,16 +376,16 @@ VariableAnnotator::annotate(Instruction &inst, Target &target,
376376 if (loc.empty ())
377377 continue ;
378378
379- Current .try_emplace (v->GetID (),
380- VarState{std::string (name), std::string (loc)});
379+ current_vars .try_emplace (v->GetID (),
380+ VarState{std::string (name), std::string (loc)});
381381 }
382382
383- // Diff Live_ → Current .
383+ // Diff m_live_vars → current_vars .
384384
385- // 1) Starts/changes: iterate Current and compare with Live_ .
386- for (const auto &KV : Current ) {
387- auto it = Live_ .find (KV.first );
388- if (it == Live_ .end ()) {
385+ // 1) Starts/changes: iterate current_vars and compare with m_live_vars .
386+ for (const auto &KV : current_vars ) {
387+ auto it = m_live_vars .find (KV.first );
388+ if (it == m_live_vars .end ()) {
389389 // Newly live.
390390 events.emplace_back (
391391 llvm::formatv (" {0} = {1}" , KV.second .name , KV.second .last_loc ).str ());
@@ -396,14 +396,14 @@ VariableAnnotator::annotate(Instruction &inst, Target &target,
396396 }
397397 }
398398
399- // 2) Ends: anything that was live but is not in Current becomes <undef>.
400- for (const auto &KV : Live_ ) {
401- if (!Current .count (KV.first ))
399+ // 2) Ends: anything that was live but is not in current_vars becomes <undef>.
400+ for (const auto &KV : m_live_vars ) {
401+ if (!current_vars .count (KV.first ))
402402 events.emplace_back (llvm::formatv (" {0} = <undef>" , KV.second .name ).str ());
403403 }
404404
405405 // Commit new state.
406- Live_ = std::move (Current );
406+ m_live_vars = std::move (current_vars );
407407 return events;
408408}
409409
@@ -677,7 +677,7 @@ void Disassembler::PrintInstructions(Debugger &debugger, const ArchSpec &arch,
677677 address_text_size);
678678
679679 if ((options & eOptionVariableAnnotations) && target_sp) {
680- auto annotations = annot.annotate (*inst, *target_sp, module_sp );
680+ auto annotations = annot.Annotate (*inst);
681681 if (!annotations.empty ()) {
682682 const size_t annotation_column = 100 ;
683683 inst_line.FillLastLineToColumn (annotation_column, ' ' );
0 commit comments