@@ -771,16 +771,19 @@ SBBreakpoint SBTarget::BreakpointCreateByName(const char *symbol_name,
771771 const bool hardware = false ;
772772 const LazyBool skip_prologue = eLazyBoolCalculate;
773773 const lldb::addr_t offset = 0 ;
774+ const bool offset_is_insn_count = false ;
774775 if (module_name && module_name[0 ]) {
775776 FileSpecList module_spec_list;
776777 module_spec_list.Append (FileSpec (module_name));
777778 sb_bp = target_sp->CreateBreakpoint (
778779 &module_spec_list, nullptr , symbol_name, eFunctionNameTypeAuto,
779- eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
780+ eLanguageTypeUnknown, offset, offset_is_insn_count, skip_prologue,
781+ internal, hardware);
780782 } else {
781783 sb_bp = target_sp->CreateBreakpoint (
782784 nullptr , nullptr , symbol_name, eFunctionNameTypeAuto,
783- eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
785+ eLanguageTypeUnknown, offset, offset_is_insn_count, skip_prologue,
786+ internal, hardware);
784787 }
785788 }
786789
@@ -816,6 +819,17 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateByName(
816819 const SBFileSpecList &comp_unit_list) {
817820 LLDB_INSTRUMENT_VA (this , symbol_name, name_type_mask, symbol_language,
818821 module_list, comp_unit_list);
822+ return BreakpointCreateByName (symbol_name, name_type_mask, symbol_language, 0 ,
823+ false , module_list, comp_unit_list);
824+ }
825+
826+ lldb::SBBreakpoint SBTarget::BreakpointCreateByName (
827+ const char *symbol_name, uint32_t name_type_mask,
828+ LanguageType symbol_language, lldb::addr_t offset,
829+ bool offset_is_insn_count, const SBFileSpecList &module_list,
830+ const SBFileSpecList &comp_unit_list) {
831+ LLDB_INSTRUMENT_VA (this , symbol_name, name_type_mask, symbol_language, offset,
832+ offset_is_insn_count, module_list, comp_unit_list);
819833
820834 SBBreakpoint sb_bp;
821835 if (TargetSP target_sp = GetSP ();
@@ -826,7 +840,8 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateByName(
826840 std::lock_guard<std::recursive_mutex> guard (target_sp->GetAPIMutex ());
827841 FunctionNameType mask = static_cast <FunctionNameType>(name_type_mask);
828842 sb_bp = target_sp->CreateBreakpoint (module_list.get (), comp_unit_list.get (),
829- symbol_name, mask, symbol_language, 0 ,
843+ symbol_name, mask, symbol_language,
844+ offset, offset_is_insn_count,
830845 skip_prologue, internal, hardware);
831846 }
832847
@@ -2013,29 +2028,10 @@ lldb::SBInstructionList SBTarget::ReadInstructions(lldb::SBAddress base_addr,
20132028
20142029 if (TargetSP target_sp = GetSP ()) {
20152030 if (Address *addr_ptr = base_addr.get ()) {
2016- DataBufferHeap data (
2017- target_sp->GetArchitecture ().GetMaximumOpcodeByteSize () * count, 0 );
2018- bool force_live_memory = true ;
2019- lldb_private::Status error;
2020- lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
2021- const size_t bytes_read =
2022- target_sp->ReadMemory (*addr_ptr, data.GetBytes (), data.GetByteSize (),
2023- error, force_live_memory, &load_addr);
2024-
2025- const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
2026- if (!flavor_string || flavor_string[0 ] == ' \0 ' ) {
2027- // FIXME - we don't have the mechanism in place to do per-architecture
2028- // settings. But since we know that for now we only support flavors on
2029- // x86 & x86_64,
2030- const llvm::Triple::ArchType arch =
2031- target_sp->GetArchitecture ().GetTriple ().getArch ();
2032- if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
2033- flavor_string = target_sp->GetDisassemblyFlavor ();
2031+ if (llvm::Expected<DisassemblerSP> disassembler =
2032+ target_sp->ReadInstructions (*addr_ptr, count, flavor_string)) {
2033+ sb_instructions.SetDisassembler (*disassembler);
20342034 }
2035- sb_instructions.SetDisassembler (Disassembler::DisassembleBytes (
2036- target_sp->GetArchitecture (), nullptr , flavor_string,
2037- target_sp->GetDisassemblyCPU (), target_sp->GetDisassemblyFeatures (),
2038- *addr_ptr, data.GetBytes (), bytes_read, count, data_from_file));
20392035 }
20402036 }
20412037
0 commit comments