[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

José Lira Junior via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 29 09:53:20 PDT 2023


junior-jl wrote:

Hi, @medismailben. I changed the code with your suggestions. Can you take a look if the early exits are correct before I commit, please?

```cpp
case 'm': // Stop at user entry point
  {
    TargetSP target_sp =
        execution_context ? execution_context->GetTargetSP() : TargetSP();
    ModuleSP main_module_sp = target_sp->GetExecutableModule();
    FileSpecList shared_lib_filter;
    shared_lib_filter.Append(main_module_sp->GetFileSpec());
    llvm::SetVector<std::string, std::vector<std::string>, std::unordered_set<std::string>> entryPointNamesSet;
    for (LanguageType lang_type : Language::GetSupportedLanguages()) {
      Language *lang = Language::FindPlugin(lang_type);
      if (!lang) {
        error.SetErrorString("Language not found\n");
        break;
      }
      std::string entryPointName = lang->GetUserEntryPointName().str();
      if (!entryPointName.empty())
        entryPointNamesSet.insert(entryPointName);
    }
    if (entryPointNamesSet.empty()) {
      error.SetErrorString("No entry point name found\n");
      break;
    }
    BreakpointSP bp_sp = target_sp->CreateBreakpoint(
    &shared_lib_filter, 
    nullptr,                 // containingSourceFiles
    entryPointNamesSet.takeVector(),     
    eFunctionNameTypeFull,   // func_name_type_mask
    eLanguageTypeUnknown,    // language
    0,                       // offset
    eLazyBoolNo,             // skip_prologue
    false,                   // internal
    false                    // hardware
    );
    if (!bp_sp) {
      error.SetErrorString("Breakpoint creation failed.\n");
      break;
    }
    bp_sp->SetOneShot(true);
    break;
  }
```

Also, thank you for the reminder of changing the description of the PR. Done :)

https://github.com/llvm/llvm-project/pull/67019


More information about the lldb-commits mailing list