From e14dc26857470f248e5fc1dd14d89314eae47fa5 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Mon, 12 Sep 2016 23:10:56 +0000 Subject: This is the main part of a change to add breakpoint save and restore to lldb. Still to come: 1) SB API's 2) Testcases 3) Loose ends: a) serialize Thread options b) serialize Exception resolvers 4) "break list --file" should list breakpoints contained in a file and "break read -f 1 3 5" should then read in only those breakpoints. llvm-svn: 281273 --- .../Breakpoint/BreakpointResolverFileLine.cpp | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'lldb/source/Breakpoint/BreakpointResolverFileLine.cpp') diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index 482b1658251..5f0b0d20eb8 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -36,6 +36,77 @@ BreakpointResolverFileLine::BreakpointResolverFileLine( BreakpointResolverFileLine::~BreakpointResolverFileLine() {} +BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( + Breakpoint *bkpt, StructuredData::Dictionary &options_dict, Error &error) { + std::string filename; + uint32_t line_no; + bool check_inlines; + bool skip_prologue; + bool exact_match; + bool success; + + lldb::addr_t offset = 0; + + success = options_dict.GetValueForKeyAsString(GetKey(OptionNames::FileName), + filename); + if (!success) { + error.SetErrorString("BRFL::CFSD: Couldn't find filename entry."); + return nullptr; + } + + success = options_dict.GetValueForKeyAsInteger( + GetKey(OptionNames::LineNumber), line_no); + if (!success) { + error.SetErrorString("BRFL::CFSD: Couldn't find line number entry."); + return nullptr; + } + + success = options_dict.GetValueForKeyAsBoolean(GetKey(OptionNames::Inlines), + check_inlines); + if (!success) { + error.SetErrorString("BRFL::CFSD: Couldn't find check inlines entry."); + return nullptr; + } + + success = options_dict.GetValueForKeyAsBoolean( + GetKey(OptionNames::SkipPrologue), skip_prologue); + if (!success) { + error.SetErrorString("BRFL::CFSD: Couldn't find skip prologue entry."); + return nullptr; + } + + success = options_dict.GetValueForKeyAsBoolean( + GetKey(OptionNames::ExactMatch), exact_match); + if (!success) { + error.SetErrorString("BRFL::CFSD: Couldn't find exact match entry."); + return nullptr; + } + + FileSpec file_spec(filename.c_str(), false); + + return new BreakpointResolverFileLine(bkpt, file_spec, line_no, offset, + check_inlines, skip_prologue, + exact_match); +} + +StructuredData::ObjectSP +BreakpointResolverFileLine::SerializeToStructuredData() { + StructuredData::DictionarySP options_dict_sp( + new StructuredData::Dictionary()); + + options_dict_sp->AddStringItem(GetKey(OptionNames::FileName), + m_file_spec.GetPath()); + options_dict_sp->AddIntegerItem(GetKey(OptionNames::LineNumber), + m_line_number); + options_dict_sp->AddBooleanItem(GetKey(OptionNames::Inlines), m_inlines); + options_dict_sp->AddBooleanItem(GetKey(OptionNames::SkipPrologue), + m_skip_prologue); + options_dict_sp->AddBooleanItem(GetKey(OptionNames::ExactMatch), + m_exact_match); + + return WrapOptionsDict(options_dict_sp); +} + Searcher::CallbackReturn BreakpointResolverFileLine::SearchCallback(SearchFilter &filter, SymbolContext &context, -- cgit v1.2.3