[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
Sun Oct 1 08:55:35 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?
> > ```c++
> > 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 :)
>
> This code in this switch statement should go into Target.h/Target.cpp as something like:
>
> ```
> lldb::BreakpointSP Target::CreateBreakpointAtUserEntry();
> ```
>
> Then the code in this switch just calls that function. Then we can expose this through the SBTarget API as well.
Done! ✅
https://github.com/llvm/llvm-project/pull/67019
More information about the lldb-commits
mailing list