================
@@ -335,6 +335,47 @@ BreakpointSP Target::GetBreakpointByID(break_id_t 
break_id) {
   return bp_sp;
 }
 
+lldb::BreakpointSP
+lldb_private::Target::CreateBreakpointAtUserEntry(Status &error) {
+  ModuleSP main_module_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");
+      return lldb::BreakpointSP();
+    }
+    std::string entryPointName = lang->GetUserEntryPointName().str();
+    if (!entryPointName.empty())
+      entryPointNamesSet.insert(entryPointName);
+  }
+  if (entryPointNamesSet.empty()) {
+    error.SetErrorString("No entry point name found\n");
+    return lldb::BreakpointSP();
+  }
+  BreakpointSP bp_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
----------------
JDevlieghere wrote:

Is there prior art in Target.cpp for specifying the arguments like this? I 
think most of the code base uses inline comments (e.g. 
`/*containingSourceFiles=*/nullptr`)

https://github.com/llvm/llvm-project/pull/67019
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to