[Lldb-commits] [lldb] [lldb] add stop-at-main option to process launch (PR #67019)
José Lira Junior via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 26 11:50:21 PDT 2023
junior-jl wrote:
This is the case in the current commit. I was trying to implement this with SmallSet and const char* to use the overload you mentioned, Jim, but I was having trouble with it, specially because I needed to hard code a 'max number of languages'. So I used the overload that takes a std::vector<std::string>. Let me know if that's not good.
```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());
std::vector<std::string> entryPointNames;
for (LanguageType lang_type : Language::GetSupportedLanguages()) {
Language *lang = Language::FindPlugin(lang_type);
if (lang) {
std::string entryPointName = lang->GetUserEntryPointName();
if (!entryPointName.empty()) {
entryPointNames.push_back(entryPointName);
}
}
}
BreakpointSP bp_sp = target_sp->CreateBreakpoint(
/*containingModules=*/&shared_lib_filter,
/*containingSourceFiles=*/nullptr,
/*func_names=*/entryPointNames,
/*func_name_type_mask=*/eFunctionNameTypeFull,
/*language=*/eLanguageTypeUnknown,
/*offset=*/0, /*skip_prologue=*/eLazyBoolNo, /*internal=*/false,
/*hardware=*/false);
if (!bp_sp)
error.SetErrorString("Breakpoint creation failed.\n");
bp_sp->SetOneShot(true);
break;
}
```
https://github.com/llvm/llvm-project/pull/67019
More information about the lldb-commits
mailing list