[Lldb-commits] [lldb] [lldb][windows] refactor null handling in DynamicLoaderWindowsDYLD (PR #200821)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 1 07:23:16 PDT 2026
================
@@ -204,24 +208,27 @@ DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(Thread &thread,
return ThreadPlanSP();
}
- InstructionList *insn_list = &disassembler_sp->GetInstructionList();
- if (insn_list == nullptr) {
- return ThreadPlanSP();
- }
+ InstructionList &insn_list = disassembler_sp->GetInstructionList();
// First instruction in a x86 Windows trampoline is going to be an indirect
// jump through the IAT and the next one will be a nop (usually there for
// alignment purposes). e.g.:
// 0x70ff4cfc <+956>: jmpl *0x7100c2a8
// 0x70ff4d02 <+962>: nop
- auto first_insn = insn_list->GetInstructionAtIndex(0);
- auto second_insn = insn_list->GetInstructionAtIndex(1);
+ auto first_insn = insn_list.GetInstructionAtIndex(0);
+ auto second_insn = insn_list.GetInstructionAtIndex(1);
ExecutionContext exe_ctx(m_process->GetTarget());
- if (first_insn == nullptr || second_insn == nullptr ||
- strcmp(first_insn->GetMnemonic(&exe_ctx), "jmpl") != 0 ||
- strcmp(second_insn->GetMnemonic(&exe_ctx), "nop") != 0) {
+ if (first_insn == nullptr || second_insn == nullptr) {
+ return ThreadPlanSP();
+ }
+
+ const char *first_mnemonic = first_insn->GetMnemonic(&exe_ctx);
+ const char *second_mnemonic = second_insn->GetMnemonic(&exe_ctx);
+ if (!first_mnemonic || !second_mnemonic ||
+ strcmp(first_mnemonic, "jmpl") != 0 ||
+ strcmp(second_mnemonic, "nop") != 0) {
return ThreadPlanSP();
}
----------------
Nerixyz wrote:
```suggestion
strcmp(second_mnemonic, "nop") != 0)
return ThreadPlanSP();
```
https://github.com/llvm/llvm-project/pull/200821
More information about the lldb-commits
mailing list