@@ -335,6 +335,45 @@ BreakpointSP Target::GetBreakpointByID(break_id_t break_id) {
335
335
return bp_sp;
336
336
}
337
337
338
+ lldb::BreakpointSP
339
+ lldb_private::Target::CreateBreakpointAtUserEntry (Status &error) {
340
+ ModuleSP main_module_sp = GetExecutableModule ();
341
+ FileSpecList shared_lib_filter;
342
+ shared_lib_filter.Append (main_module_sp->GetFileSpec ());
343
+ llvm::SetVector<std::string, std::vector<std::string>,
344
+ std::unordered_set<std::string>>
345
+ entryPointNamesSet;
346
+ for (LanguageType lang_type : Language::GetSupportedLanguages ()) {
347
+ Language *lang = Language::FindPlugin (lang_type);
348
+ if (!lang) {
349
+ error.SetErrorString (" Language not found\n " );
350
+ return lldb::BreakpointSP ();
351
+ }
352
+ std::string entryPointName = lang->GetUserEntryPointName ().str ();
353
+ if (!entryPointName.empty ())
354
+ entryPointNamesSet.insert (entryPointName);
355
+ }
356
+ if (entryPointNamesSet.empty ()) {
357
+ error.SetErrorString (" No entry point name found\n " );
358
+ return lldb::BreakpointSP ();
359
+ }
360
+ BreakpointSP bp_sp = CreateBreakpoint (
361
+ &shared_lib_filter,
362
+ /* containingSourceFiles=*/ nullptr , entryPointNamesSet.takeVector (),
363
+ /* func_name_type_mask=*/ eFunctionNameTypeFull,
364
+ /* language=*/ eLanguageTypeUnknown,
365
+ /* offset=*/ 0 ,
366
+ /* skip_prologue=*/ eLazyBoolNo,
367
+ /* internal=*/ false ,
368
+ /* hardware=*/ false );
369
+ if (!bp_sp) {
370
+ error.SetErrorString (" Breakpoint creation failed.\n " );
371
+ return lldb::BreakpointSP ();
372
+ }
373
+ bp_sp->SetOneShot (true );
374
+ return bp_sp;
375
+ }
376
+
338
377
BreakpointSP Target::CreateSourceRegexBreakpoint (
339
378
const FileSpecList *containingModules,
340
379
const FileSpecList *source_file_spec_list,
0 commit comments