[Lldb-commits] [PATCH] D30286: Implement QPassSignals GDB package in lldb-server
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. Looks great. Thank you. https://reviews.llvm.org/D30286 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r296101 - Implement QPassSignals GDB package in lldb-server
Author: labath Date: Fri Feb 24 03:29:14 2017 New Revision: 296101 URL: http://llvm.org/viewvc/llvm-project?rev=296101&view=rev Log: Implement QPassSignals GDB package in lldb-server Summary: QPassSignals package allows lldb client to tell lldb-server to ignore certain types of signals and re-inject them back to inferior without stopping execution. Reviewers: jmajors, labath Subscribers: danalbert, srhines, emaste, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D30286 Author: Eugene Zemtsov Added: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/Makefile lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/main.cpp Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py lldb/trunk/source/Host/common/NativeProcessProtocol.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp lldb/trunk/source/Utility/StringExtractorGDBRemote.h Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=296101&r1=296100&r2=296101&view=diff == --- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original) +++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Fri Feb 24 03:29:14 2017 @@ -17,6 +17,8 @@ #include "lldb/Utility/Error.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-types.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringRef.h" #include "NativeBreakpointList.h" @@ -64,6 +66,12 @@ public: virtual Error Kill() = 0; + //-- + // Tells a process not to stop the inferior on given signals + // and just reinject them back. + //-- + virtual Error IgnoreSignals(llvm::ArrayRef signals); + //-- // Memory and memory region functions //-- @@ -308,6 +316,10 @@ protected: int m_terminal_fd; uint32_t m_stop_id; + // Set of signal numbers that LLDB directly injects back to inferior + // without stopping it. + llvm::DenseSet m_signals_to_ignore; + // lldb_private::Host calls should be used to launch a process for debugging, // and // then the process should be attached to. When attaching to a process Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py?rev=296101&r1=296100&r2=296101&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py Fri Feb 24 03:29:14 2017 @@ -929,7 +929,8 @@ class GdbRemoteTestCaseBase(TestBase): "qXfer:libraries:read", "qXfer:libraries-svr4:read", "qXfer:features:read", -"qEcho" +"qEcho", +"QPassSignals" ] def parse_qSupported_response(self, context): Added: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/Makefile?rev=296101&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/Makefile Fri Feb 24 03:29:14 2017 @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/
[Lldb-commits] [PATCH] D30286: Implement QPassSignals GDB package in lldb-server
This revision was automatically updated to reflect the committed changes. Closed by commit rL296101: Implement QPassSignals GDB package in lldb-server (authored by labath). Changed prior to commit: https://reviews.llvm.org/D30286?vs=89575&id=89623#toc Repository: rL LLVM https://reviews.llvm.org/D30286 Files: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/Makefile lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/main.cpp lldb/trunk/source/Host/common/NativeProcessProtocol.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp lldb/trunk/source/Utility/StringExtractorGDBRemote.h Index: lldb/trunk/source/Utility/StringExtractorGDBRemote.h === --- lldb/trunk/source/Utility/StringExtractorGDBRemote.h +++ lldb/trunk/source/Utility/StringExtractorGDBRemote.h @@ -96,6 +96,7 @@ // debug server packages eServerPacketType_QEnvironmentHexEncoded, eServerPacketType_QListThreadsInStopReply, +eServerPacketType_QPassSignals, eServerPacketType_QRestoreRegisterState, eServerPacketType_QSaveRegisterState, eServerPacketType_QSetLogging, Index: lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp === --- lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp +++ lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp @@ -91,6 +91,10 @@ return eServerPacketType_QEnvironmentHexEncoded; break; +case 'P': + if (PACKET_STARTS_WITH("QPassSignals:")) +return eServerPacketType_QPassSignals; + case 'S': if (PACKET_MATCHES("QStartNoAckMode")) return eServerPacketType_QStartNoAckMode; Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -838,6 +838,7 @@ response.PutCString(";QListThreadsInStopReply+"); response.PutCString(";qEcho+"); #if defined(__linux__) + response.PutCString(";QPassSignals+"); response.PutCString(";qXfer:auxv:read+"); #endif Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h @@ -203,6 +203,8 @@ PacketResult Handle_qFileLoadAddress(StringExtractorGDBRemote &packet); + PacketResult Handle_QPassSignals(StringExtractorGDBRemote &packet); + void SetCurrentThreadID(lldb::tid_t tid); lldb::tid_t GetCurrentThreadID() const; Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -181,6 +181,9 @@ &GDBRemoteCommunicationServerLLGS::Handle_Z); RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_z, &GDBRemoteCommunicationServerLLGS::Handle_z); + RegisterMemberFunctionHandler( + StringExtractorGDBRemote::eServerPacketType_QPassSignals, + &GDBRemoteCommunicationServerLLGS::Handle_QPassSignals); RegisterPacketHandler(StringExtractorGDBRemote::eServerPacketType_k, [this](StringExtractorGDBRemote packet, Error &error, @@ -3072,6 +3075,40 @@ return SendPacketNoLock(response.GetString()); } +GDBRemoteCommunication::PacketResult +GDBRemoteCommunicationServerLLGS::Handle_QPassSignals( +StringExtractorGDBRemote &packet) { + std::vector signals; + packet.SetFilePos(strlen("QPassSignals:")); + + // Read sequence of hex signal numbers divided by a semicolon and + // optionally spaces. + while (packet.GetBytesLeft() > 0) { +int signal = packet.GetS32(-1, 16); +if (signal < 0) + return SendIllFormedResponse(packet, "Fail
[Lldb-commits] [PATCH] D30054: Delete DataBufferMemoryMap
labath added a comment. I am not sure if this is a voting situation, but I agree with what Zachary said above. Since we're already speaking about tests, it looks like the new DataBufferLLVM class could use a unit test or two, just so we get in the habit of writing those. https://reviews.llvm.org/D30054 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r296107 - Attempt to fix windows unit tests
Author: labath Date: Fri Feb 24 05:17:40 2017 New Revision: 296107 URL: http://llvm.org/viewvc/llvm-project?rev=296107&view=rev Log: Attempt to fix windows unit tests In LLVM r296049, IPDBSession::getGlobalScope lost its constness. Adjust the unittest to account for that. Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=296107&r1=296106&r2=296107&view=diff == --- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original) +++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Fri Feb 24 05:17:40 2017 @@ -120,7 +120,7 @@ protected: return false; } - uint64_t GetGlobalConstantInteger(const llvm::pdb::IPDBSession &session, + uint64_t GetGlobalConstantInteger(llvm::pdb::IPDBSession &session, llvm::StringRef var) const { auto global = session.getGlobalScope(); auto results = @@ -371,7 +371,7 @@ TEST_F(SymbolFilePDBTests, TestSimpleCla SymbolVendor *plugin = module->GetSymbolVendor(); SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); - const llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); + llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; @@ -394,7 +394,7 @@ TEST_F(SymbolFilePDBTests, TestNestedCla SymbolVendor *plugin = module->GetSymbolVendor(); SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); - const llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); + llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; @@ -417,7 +417,7 @@ TEST_F(SymbolFilePDBTests, TestClassInNa SymbolVendor *plugin = module->GetSymbolVendor(); SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); - const llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); + llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; @@ -440,7 +440,7 @@ TEST_F(SymbolFilePDBTests, TestEnumTypes SymbolVendor *plugin = module->GetSymbolVendor(); SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); - const llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); + llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); SymbolContext sc; llvm::DenseSet searched_files; const char *EnumsToCheck[] = {"Enum", "ShortEnum"}; @@ -487,7 +487,7 @@ TEST_F(SymbolFilePDBTests, TestTypedefs) SymbolVendor *plugin = module->GetSymbolVendor(); SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); - const llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); + llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D29669: Hardware breakpoints implementation for Arm/AArch64 targets
omjavaid updated this revision to Diff 89642. omjavaid edited the summary of this revision. omjavaid added a comment. Herald added a subscriber: srhines. @labath Hi I have updated diff with corrections. Thanks! https://reviews.llvm.org/D29669 Files: include/lldb/Host/common/NativeBreakpointList.h include/lldb/Host/common/NativeProcessProtocol.h include/lldb/Host/common/NativeRegisterContext.h include/lldb/Host/common/NativeThreadProtocol.h packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py source/Host/common/NativeProcessProtocol.cpp source/Host/common/NativeRegisterContext.cpp source/Plugins/Process/Linux/NativeProcessLinux.cpp source/Plugins/Process/Linux/NativeProcessLinux.h source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h source/Plugins/Process/Linux/NativeThreadLinux.cpp source/Plugins/Process/Linux/NativeThreadLinux.h source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -2531,12 +2531,14 @@ packet, "Too short z packet, missing software/hardware specifier"); bool want_breakpoint = true; + bool want_hardware = false; const GDBStoppointType stoppoint_type = GDBStoppointType(packet.GetS32(eStoppointInvalid)); switch (stoppoint_type) { case eBreakpointHardware: want_breakpoint = true; +want_hardware = true; break; case eBreakpointSoftware: want_breakpoint = true; @@ -2579,7 +2581,8 @@ if (want_breakpoint) { // Try to clear the breakpoint. -const Error error = m_debugged_process_sp->RemoveBreakpoint(addr); +const Error error = +m_debugged_process_sp->RemoveBreakpoint(addr, want_hardware); if (error.Success()) return SendOKResponse(); Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); @@ -3037,9 +3040,14 @@ if (packet.GetChar() != ':') return SendErrorResponse(67); - uint32_t num = m_debugged_process_sp->GetMaxWatchpoints(); + auto hw_debug_cap = m_debugged_process_sp->GetHardwareDebugSupportInfo(); + StreamGDBRemote response; - response.Printf("num:%d;", num); + if (hw_debug_cap == llvm::None) +response.Printf("num:0;"); + else +response.Printf("num:%d;", hw_debug_cap->second); + return SendPacketNoLock(response.GetString()); } Index: source/Plugins/Process/Linux/NativeThreadLinux.h === --- source/Plugins/Process/Linux/NativeThreadLinux.h +++ source/Plugins/Process/Linux/NativeThreadLinux.h @@ -46,6 +46,10 @@ Error RemoveWatchpoint(lldb::addr_t addr) override; + Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; + + Error RemoveHardwareBreakpoint(lldb::addr_t addr) override; + private: // - // Interface for friend classes @@ -102,6 +106,7 @@ std::string m_stop_description; using WatchpointIndexMap = std::map; WatchpointIndexMap m_watchpoint_index_map; + WatchpointIndexMap m_hw_break_index_map; std::unique_ptr m_step_workaround; }; Index: source/Plugins/Process/Linux/NativeThreadLinux.cpp === --- source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -190,6 +190,38 @@ return Error("Clearing hardware watchpoint failed."); } +Error NativeThreadLinux::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) { + if (m_state == eStateLaunching) +return Error(); + + Error error = RemoveHardwareBreakpoint(addr); + if (error.Fail()) +return error; + + NativeRegisterContextSP reg_ctx = GetRegisterContext(); + uint32_t bp_index = reg_ctx->SetHardwareBreakpoint(addr, size); + + if (bp_index == LLDB_INVALID_INDEX32) +return Error("Setting hardware breakpoint failed."); + + m_hw_break_index_map.insert({addr, bp_index}); + return Error(); +} + +Error NativeThreadLinux::RemoveHardwareBreakpoint(lldb::addr_t addr) { + auto
[Lldb-commits] [PATCH] D30249: Clear expression when breakpoint location becomes unresolved
labath updated this revision to Diff 89645. labath added a comment. Switch SBBreakpoint to weak_ptr. This diff is pretty big but it amounts to s/m_opaque_sp/m_opaque_wp and inserting a lock at the beginning of every function. Since I had to touch them anyway, I took the opportunity to upgrade the logging statements. If this is ok, I'll follow this up with the same change for SBBreakpointLocation and SBWatchpoint. https://reviews.llvm.org/D30249 Files: include/lldb/API/SBBreakpoint.h packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py source/API/SBBreakpoint.cpp source/API/SBBreakpointLocation.cpp source/API/SBTarget.cpp Index: source/API/SBTarget.cpp === --- source/API/SBTarget.cpp +++ source/API/SBTarget.cpp @@ -686,7 +686,7 @@ if (sb_module_list.GetSize() > 0) { module_list = sb_module_list.get(); } -*sb_bp = target_sp->CreateBreakpoint( +sb_bp = target_sp->CreateBreakpoint( module_list, *sb_file_spec, line, offset, check_inlines, skip_prologue, internal, hardware, move_to_nearest_code); } @@ -699,7 +699,7 @@ log->Printf("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => " "SBBreakpoint(%p): %s", static_cast(target_sp.get()), path, line, -static_cast(sb_bp.get()), sstr.GetData()); +static_cast(sb_bp.GetSP().get()), sstr.GetData()); } return sb_bp; @@ -721,11 +721,11 @@ if (module_name && module_name[0]) { FileSpecList module_spec_list; module_spec_list.Append(FileSpec(module_name, false)); - *sb_bp = target_sp->CreateBreakpoint( + sb_bp = target_sp->CreateBreakpoint( &module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, offset, skip_prologue, internal, hardware); } else { - *sb_bp = target_sp->CreateBreakpoint( + sb_bp = target_sp->CreateBreakpoint( NULL, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, offset, skip_prologue, internal, hardware); } @@ -735,7 +735,7 @@ log->Printf("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", " "module=\"%s\") => SBBreakpoint(%p)", static_cast(target_sp.get()), symbol_name, module_name, -static_cast(sb_bp.get())); +static_cast(sb_bp.GetSP().get())); return sb_bp; } @@ -771,16 +771,16 @@ const bool hardware = false; const LazyBool skip_prologue = eLazyBoolCalculate; std::lock_guard guard(target_sp->GetAPIMutex()); -*sb_bp = target_sp->CreateBreakpoint( +sb_bp = target_sp->CreateBreakpoint( module_list.get(), comp_unit_list.get(), symbol_name, name_type_mask, symbol_language, 0, skip_prologue, internal, hardware); } if (log) log->Printf("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", " "name_type: %d) => SBBreakpoint(%p)", static_cast(target_sp.get()), symbol_name, -name_type_mask, static_cast(sb_bp.get())); +name_type_mask, static_cast(sb_bp.GetSP().get())); return sb_bp; } @@ -815,7 +815,7 @@ const bool internal = false; const bool hardware = false; const LazyBool skip_prologue = eLazyBoolCalculate; -*sb_bp = target_sp->CreateBreakpoint( +sb_bp = target_sp->CreateBreakpoint( module_list.get(), comp_unit_list.get(), symbol_names, num_names, name_type_mask, symbol_language, offset, skip_prologue, internal, hardware); @@ -836,7 +836,7 @@ log->Printf("\"\"%c ", sep); } log->Printf("name_type: %d) => SBBreakpoint(%p)", name_type_mask, -static_cast(sb_bp.get())); +static_cast(sb_bp.GetSP().get())); } return sb_bp; @@ -875,16 +875,16 @@ const bool hardware = false; const LazyBool skip_prologue = eLazyBoolCalculate; -*sb_bp = target_sp->CreateFuncRegexBreakpoint( +sb_bp = target_sp->CreateFuncRegexBreakpoint( module_list.get(), comp_unit_list.get(), regexp, symbol_language, skip_prologue, internal, hardware); } if (log) log->Printf("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") " "=> SBBreakpoint(%p)", static_cast(target_sp.get()), symbol_name_regex, -static_cast(sb_bp.get())); +static_cast(sb_bp.GetSP().get())); return sb_bp; } @@ -897,15 +897,15 @@ if (target_sp) { std::lock_guard guard(target_sp->GetAPIMutex()); const bool hardware = false; -*sb_bp = target_sp->CreateBreakpoint(address, false, hardware); +sb_bp = target_sp->CreateBreakpoint(address, false, hardware); } if (log) log->Printf("SBTarget(%p)::BreakpointCreateBy
[Lldb-commits] [PATCH] D29669: Hardware breakpoints implementation for Arm/AArch64 targets
labath accepted this revision. labath added a comment. lgtm, thanks. Comment at: packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp:30 + + hw_break_mutex.lock(); + I know it's only a test program, but you generally should never lock the mutex manually. `std::lock_guard guard(mutex)` https://reviews.llvm.org/D29669 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D30334: Remove the callback-based log channel registration mechanism
labath created this revision. All the existing channels have beens switched to the new mechanism and this code is now unused. https://reviews.llvm.org/D30334 Files: include/lldb/Core/Log.h source/API/SBCommandReturnObject.cpp source/Core/Log.cpp Index: source/Core/Log.cpp === --- source/Core/Log.cpp +++ source/Core/Log.cpp @@ -221,16 +221,6 @@ free(arg_msg); } -typedef std::map CallbackMap; -typedef CallbackMap::iterator CallbackMapIter; - -// Surround our callback map with a singleton function so we don't have any -// global initializers. -static CallbackMap &GetCallbackMap() { - static CallbackMap g_callback_map; - return g_callback_map; -} - void Log::Register(llvm::StringRef name, Channel &channel) { auto iter = g_channel_map->try_emplace(name, channel); assert(iter.second == true); @@ -244,37 +234,10 @@ g_channel_map->erase(iter); } -void Log::RegisterLogChannel(const ConstString &channel, - const Log::Callbacks &log_callbacks) { - GetCallbackMap().insert(std::make_pair(channel, log_callbacks)); -} - -bool Log::UnregisterLogChannel(const ConstString &channel) { - return GetCallbackMap().erase(channel) != 0; -} - -bool Log::GetLogChannelCallbacks(const ConstString &channel, - Log::Callbacks &log_callbacks) { - CallbackMap &callback_map = GetCallbackMap(); - CallbackMapIter pos = callback_map.find(channel); - if (pos != callback_map.end()) { -log_callbacks = pos->second; -return true; - } - ::memset(&log_callbacks, 0, sizeof(log_callbacks)); - return false; -} - bool Log::EnableLogChannel( const std::shared_ptr &log_stream_sp, uint32_t log_options, llvm::StringRef channel, const char **categories, Stream &error_stream) { - Log::Callbacks log_callbacks; - if (Log::GetLogChannelCallbacks(ConstString(channel), log_callbacks)) { -log_callbacks.enable(log_stream_sp, log_options, categories, &error_stream); -return true; - } - auto iter = g_channel_map->find(channel); if (iter == g_channel_map->end()) { error_stream.Format("Invalid log channel '{0}'.\n", channel); @@ -289,12 +252,6 @@ bool Log::DisableLogChannel(llvm::StringRef channel, const char **categories, Stream &error_stream) { - Log::Callbacks log_callbacks; - if (Log::GetLogChannelCallbacks(ConstString(channel), log_callbacks)) { -log_callbacks.disable(categories, &error_stream); -return true; - } - auto iter = g_channel_map->find(channel); if (iter == g_channel_map->end()) { error_stream.Format("Invalid log channel '{0}'.\n", channel); @@ -308,12 +265,6 @@ } bool Log::ListChannelCategories(llvm::StringRef channel, Stream &stream) { - Log::Callbacks log_callbacks; - if (Log::GetLogChannelCallbacks(ConstString(channel), log_callbacks)) { -log_callbacks.list_categories(&stream); -return true; - } - auto ch = g_channel_map->find(channel); if (ch == g_channel_map->end()) { stream.Format("Invalid log channel '{0}'.\n", channel); @@ -324,29 +275,16 @@ } void Log::DisableAllLogChannels(Stream *feedback_strm) { - CallbackMap &callback_map = GetCallbackMap(); - CallbackMapIter pos, end = callback_map.end(); - const char *categories[] = {"all", nullptr}; - - for (pos = callback_map.begin(); pos != end; ++pos) -pos->second.disable(categories, feedback_strm); - for (auto &entry : *g_channel_map) entry.second.channel.Disable(UINT32_MAX); } void Log::ListAllLogChannels(Stream *strm) { - CallbackMap &callback_map = GetCallbackMap(); - - if (callback_map.empty() && g_channel_map->empty()) { + if (g_channel_map->empty()) { strm->PutCString("No logging channels are currently registered.\n"); return; } - CallbackMapIter pos, end = callback_map.end(); - for (pos = callback_map.begin(); pos != end; ++pos) -pos->second.list_categories(strm); - for (const auto &channel : *g_channel_map) ListCategories(*strm, channel); } Index: source/API/SBCommandReturnObject.cpp === --- source/API/SBCommandReturnObject.cpp +++ source/API/SBCommandReturnObject.cpp @@ -17,6 +17,7 @@ #include "lldb/Core/Log.h" #include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/ConstString.h" #include "lldb/Utility/Error.h" using namespace lldb; Index: include/lldb/Core/Log.h === --- include/lldb/Core/Log.h +++ include/lldb/Core/Log.h @@ -12,7 +12,6 @@ // Project includes #include "lldb/Core/Logging.h" -#include "lldb/Utility/ConstString.h" #include "lldb/Utility/Flags.h" #include "lldb/lldb-private.h" @@ -93,35 +92,11 @@ }; //-- - // Callback definitions for abstracted plug-in log access. - //---
[Lldb-commits] [PATCH] D29669: Hardware breakpoints implementation for Arm/AArch64 targets
This revision was automatically updated to reflect the committed changes. Closed by commit rL296119: Hardware breakpoints for Linux on Arm/AArch64 targets (authored by omjavaid). Changed prior to commit: https://reviews.llvm.org/D29669?vs=89642&id=89654#toc Repository: rL LLVM https://reviews.llvm.org/D29669 Files: lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py lldb/trunk/source/Host/common/NativeProcessProtocol.cpp lldb/trunk/source/Host/common/NativeRegisterContext.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -2534,12 +2534,14 @@ packet, "Too short z packet, missing software/hardware specifier"); bool want_breakpoint = true; + bool want_hardware = false; const GDBStoppointType stoppoint_type = GDBStoppointType(packet.GetS32(eStoppointInvalid)); switch (stoppoint_type) { case eBreakpointHardware: want_breakpoint = true; +want_hardware = true; break; case eBreakpointSoftware: want_breakpoint = true; @@ -2582,7 +2584,8 @@ if (want_breakpoint) { // Try to clear the breakpoint. -const Error error = m_debugged_process_sp->RemoveBreakpoint(addr); +const Error error = +m_debugged_process_sp->RemoveBreakpoint(addr, want_hardware); if (error.Success()) return SendOKResponse(); Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); @@ -3040,9 +3043,14 @@ if (packet.GetChar() != ':') return SendErrorResponse(67); - uint32_t num = m_debugged_process_sp->GetMaxWatchpoints(); + auto hw_debug_cap = m_debugged_process_sp->GetHardwareDebugSupportInfo(); + StreamGDBRemote response; - response.Printf("num:%d;", num); + if (hw_debug_cap == llvm::None) +response.Printf("num:0;"); + else +response.Printf("num:%d;", hw_debug_cap->second); + return SendPacketNoLock(response.GetString()); } Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp === --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp @@ -130,6 +130,7 @@ ::memset(&m_fpr, 0, sizeof(m_fpr)); ::memset(&m_gpr_arm, 0, sizeof(m_gpr_arm)); ::memset(&m_hwp_regs, 0, sizeof(m_hwp_regs)); + ::memset(&m_hbr_regs, 0, sizeof(m_hbr_regs)); // 16 is just a maximum value, query hardware for actual watchpoint count m_max_hwp_supported = 16; @@ -354,10 +355,28 @@ return (m_reg_info.first_fpr <= reg && reg <= m_reg_info.last_fpr); } +uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareBreakpoints() { + Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS)); + + if (log) +log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__); + + Error error; + + // Read hardware breakpoint and watchpoint information. + error = ReadHardwareDebugInfo(); + + if (error.Fail()) +return 0; + + LLDB_LOG(log, "{0}", m_max_hbp_supported); + return m_max_hbp_supported; +} + uint32_t NativeRegisterContextLinux_arm::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSe
[Lldb-commits] [lldb] r296119 - Hardware breakpoints for Linux on Arm/AArch64 targets
Author: omjavaid Date: Fri Feb 24 07:27:31 2017 New Revision: 296119 URL: http://llvm.org/viewvc/llvm-project?rev=296119&view=rev Log: Hardware breakpoints for Linux on Arm/AArch64 targets Please look at below differential link for upstream discussion. Differential revision: https://reviews.llvm.org/D29669 Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/main.cpp Modified: lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py lldb/trunk/source/Host/common/NativeProcessProtocol.cpp lldb/trunk/source/Host/common/NativeRegisterContext.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.h lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Modified: lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h?rev=296119&r1=296118&r2=296119&view=diff == --- lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h (original) +++ lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h Fri Feb 24 07:27:31 2017 @@ -19,6 +19,14 @@ #include namespace lldb_private { + +struct HardwareBreakpoint { + lldb::addr_t m_addr; + size_t m_size; +}; + +using HardwareBreakpointMap = std::map; + class NativeBreakpointList { public: typedef std::functionhttp://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=296119&r1=296118&r2=296119&view=diff == --- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original) +++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Fri Feb 24 07:27:31 2017 @@ -107,18 +107,28 @@ public: virtual Error SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) = 0; - virtual Error RemoveBreakpoint(lldb::addr_t addr); + virtual Error RemoveBreakpoint(lldb::addr_t addr, bool hardware = false); virtual Error EnableBreakpoint(lldb::addr_t addr); virtual Error DisableBreakpoint(lldb::addr_t addr); //-- + // Hardware Breakpoint functions + //-- + virtual const HardwareBreakpointMap &GetHardwareBreakpointMap() const; + + virtual Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size); + + virtual Error RemoveHardwareBreakpoint(lldb::addr_t addr); + + //-- // Watchpoint functions //-- virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const; - virtual uint32_t GetMaxWatchpoints() const; + virtual llvm::Optional> + GetHardwareDebugSupportInfo() const; virtual Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware); @@ -313,6 +323,7 @@ protected: std::vector m_delegates; NativeBreakpointList m_breakpoint_list; NativeWatchpointList m_watchpoint_list; + HardwareBreakpointMap m_hw_breakpoints_map; int m_terminal_fd; uint32_t m_stop_id; Modified: lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/Nativ
[Lldb-commits] [PATCH] D30272: Improve data formatter for libstdcpp unique_ptr
tberghammer added a comment. Thank you the comments. Based on them I have the following proposal: - Add a new property to value object with name "m_is_dereference_of_parent" - Add a new static method named "CreateCopy(name, valobj, is_dereference_of_parent)" to ValueObject and to SBValue what will create a new value object with the same type and data as the original value object with m_is_dereference_of_parent is set (I am open to suggestions for a better name). The reason I need to create a copy of the value object instead of modifying it in place is that if the dereferenced object is referenced without using a synthetic child provider then this flag shouldn't be set and the cleanest way to achieve this is to have 2 separate value object instances. - From the synthetic child providers when we want to create a child what is the dereference of the parent (e.g. object for unique_ptr) then we will use the above CreateCopy method - We will decrement the pointer depth during display every time we go through an object marked as m_is_dereference_of_parent - In "frame variable" when the user uses "operator*" or "operator->" we return the first child with m_is_dereference_of_parent (possibly return an error if multiple child has it set) I think this approach satisfies all the requirements we had (extensibility, dereference support, loop detection) and makes the API fairly clean. What do you think? https://reviews.llvm.org/D30272 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D30054: Delete DataBufferMemoryMap
I left out unit tests since we'd essentially be duplicating the unit tests of MemoryBuffer, and because it involves the file system (also this is temporary code until DataBuffer stuff goes away). Lmk if you disagree though On Fri, Feb 24, 2017 at 2:53 AM Pavel Labath via Phabricator < revi...@reviews.llvm.org> wrote: > labath added a comment. > > I am not sure if this is a voting situation, but I agree with what Zachary > said above. > > Since we're already speaking about tests, it looks like the new > DataBufferLLVM class could use a unit test or two, just so we get in the > habit of writing those. > > > https://reviews.llvm.org/D30054 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D30054: Delete DataBufferMemoryMap
I am going to move the constructor to private for now, this should eliminate any disagreement about whether to add null checks, as it is now literally impossible to construct one with a null pointer. For now this doesn't matter since nobody is even using the MemoryBuffer constructor except from internally. We can re-visit this in the future if we have need for external users to construct one with a MemoryBuffer. On Fri, Feb 24, 2017 at 7:18 AM Zachary Turner wrote: > I left out unit tests since we'd essentially be duplicating the unit tests > of MemoryBuffer, and because it involves the file system (also this is > temporary code until DataBuffer stuff goes away). Lmk if you disagree > though > On Fri, Feb 24, 2017 at 2:53 AM Pavel Labath via Phabricator < > revi...@reviews.llvm.org> wrote: > > labath added a comment. > > I am not sure if this is a voting situation, but I agree with what Zachary > said above. > > Since we're already speaking about tests, it looks like the new > DataBufferLLVM class could use a unit test or two, just so we get in the > habit of writing those. > > > https://reviews.llvm.org/D30054 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D30249: Clear expression when breakpoint location becomes unresolved
jingham accepted this revision. jingham added a comment. This revision is now accepted and ready to land. This looks fine. It reads a little odd to me that the BreakpointSP recipient of GetSP is generally called opaque_sp after the patch. Historically it makes sense because it was the result of the substitution m_opaque_sp -> opaque_sp. But if you didn't know that it might seem odd, since there's nothing opaque about it. Something like "bkpt_sp" would read more naturally. OTOH is does make the patch larger, so I don't feel very strongly about it. https://reviews.llvm.org/D30249 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D30054: Delete DataBufferMemoryMap
This revision was automatically updated to reflect the committed changes. Closed by commit rL296159: Delete DataBufferMemoryMap. (authored by zturner). Changed prior to commit: https://reviews.llvm.org/D30054?vs=89547&id=89701#toc Repository: rL LLVM https://reviews.llvm.org/D30054 Files: lldb/trunk/include/lldb/Core/DataBufferHeap.h lldb/trunk/include/lldb/Core/DataBufferLLVM.h lldb/trunk/include/lldb/Core/DataBufferMemoryMap.h lldb/trunk/include/lldb/Host/FileSpec.h lldb/trunk/source/Core/CMakeLists.txt lldb/trunk/source/Core/DataBufferLLVM.cpp lldb/trunk/source/Core/DataBufferMemoryMap.cpp lldb/trunk/source/Host/common/FileSpec.cpp lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Index: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp === --- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp +++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp @@ -19,13 +19,15 @@ #include "gtest/gtest.h" #include "lldb/Core/ArchSpec.h" +#include "lldb/Core/DataBufferLLVM.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Host/FileSpec.h" #include "lldb/Target/MemoryRegionInfo.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" // C includes @@ -49,11 +51,11 @@ void SetUpData(const char *minidump_filename, size_t load_size = SIZE_MAX) { llvm::SmallString<128> filename = inputs_folder; llvm::sys::path::append(filename, minidump_filename); -FileSpec minidump_file(filename.c_str(), false); -lldb::DataBufferSP data_sp( -minidump_file.MemoryMapFileContents(0, load_size)); + +auto BufferPtr = DataBufferLLVM::CreateFromPath(filename, load_size, 0); + llvm::Optional optional_parser = -MinidumpParser::Create(data_sp); +MinidumpParser::Create(BufferPtr); ASSERT_TRUE(optional_parser.hasValue()); parser.reset(new MinidumpParser(optional_parser.getValue())); ASSERT_GT(parser->GetData().size(), 0UL); Index: lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp === --- lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -12,7 +12,7 @@ #include "ThreadMinidump.h" // Other libraries and framework includes -#include "lldb/Core/DataBufferHeap.h" +#include "lldb/Core/DataBufferLLVM.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" @@ -25,6 +25,7 @@ #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/LLDBAssert.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Threading.h" // C includes @@ -50,20 +51,25 @@ lldb::ProcessSP process_sp; // Read enough data for the Minidump header - const size_t header_size = sizeof(MinidumpHeader); - lldb::DataBufferSP data_sp(crash_file->MemoryMapFileContents(0, header_size)); - if (!data_sp) + constexpr size_t header_size = sizeof(MinidumpHeader); + auto DataPtr = + DataBufferLLVM::CreateFromFileSpec(*crash_file, header_size, 0); + if (!DataPtr) return nullptr; + assert(DataPtr->GetByteSize() == header_size); + // first, only try to parse the header, beacuse we need to be fast - llvm::ArrayRef header_data(data_sp->GetBytes(), header_size); - const MinidumpHeader *header = MinidumpHeader::Parse(header_data); + llvm::ArrayRef HeaderBytes = DataPtr->GetData(); + const MinidumpHeader *header = MinidumpHeader::Parse(HeaderBytes); + if (header == nullptr) +return nullptr; - if (data_sp->GetByteSize() != header_size || header == nullptr) + auto AllData = DataBufferLLVM::CreateFromFileSpec(*crash_file, -1, 0); + if (!AllData) return nullptr; - lldb::DataBufferSP all_data_sp(crash_file->MemoryMapFileContents()); - auto minidump_parser = MinidumpParser::Create(all_data_sp); + auto minidump_parser = MinidumpParser::Create(AllData); // check if the parser object is valid if (!minidump_parser) return nullptr; Index: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp === --- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -28,15 +28,17 @@ #endif #include "lldb/Core/ArchSpec.h" -#include "lldb/Core/DataBuffer.h" +#include "
[Lldb-commits] [lldb] r296159 - Delete DataBufferMemoryMap.
Author: zturner Date: Fri Feb 24 12:56:49 2017 New Revision: 296159 URL: http://llvm.org/viewvc/llvm-project?rev=296159&view=rev Log: Delete DataBufferMemoryMap. After a series of patches on the LLVM side to get the mmaping code up to compatibility with LLDB's needs, it is now ready to go, which means LLDB's custom mmapping code is redundant. So this patch deletes it all and uses LLVM's code instead. In the future, we could take this one step further and delete even the lldb DataBuffer base class and rely entirely on LLVM's facilities, but this is a job for another day. Differential Revision: https://reviews.llvm.org/D30054 Added: lldb/trunk/include/lldb/Core/DataBufferLLVM.h lldb/trunk/source/Core/DataBufferLLVM.cpp Removed: lldb/trunk/include/lldb/Core/DataBufferMemoryMap.h lldb/trunk/source/Core/DataBufferMemoryMap.cpp Modified: lldb/trunk/include/lldb/Core/DataBufferHeap.h lldb/trunk/include/lldb/Host/FileSpec.h lldb/trunk/source/Core/CMakeLists.txt lldb/trunk/source/Host/common/FileSpec.cpp lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Modified: lldb/trunk/include/lldb/Core/DataBufferHeap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/DataBufferHeap.h?rev=296159&r1=296158&r2=296159&view=diff == --- lldb/trunk/include/lldb/Core/DataBufferHeap.h (original) +++ lldb/trunk/include/lldb/Core/DataBufferHeap.h Fri Feb 24 12:56:49 2017 @@ -25,7 +25,8 @@ namespace lldb_private { /// the object. This class is best used to store chunks of data that /// are created or read from sources that can't intelligently and lazily /// fault new data pages in. Large amounts of data that comes from files -/// should probably use the DataBufferMemoryMap class. +/// should probably use DataBufferLLVM, which can intelligently determine +/// when memory mapping is optimal. //-- class DataBufferHeap : public DataBuffer { public: Added: lldb/trunk/include/lldb/Core/DataBufferLLVM.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/DataBufferLLVM.h?rev=296159&view=auto == --- lldb/trunk/include/lldb/Core/DataBufferLLVM.h (added) +++ lldb/trunk/include/lldb/Core/DataBufferLLVM.h Fri Feb 24 12:56:49 2017 @@ -0,0 +1,46 @@ +//===--- DataBufferLLVM.h ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef LLDB_CORE_DATABUFFERLLVM_H +#define LLDB_CORE_DATABUFFERLLVM_H + +#include "lldb/Core/DataBuffer.h" + +#include + +namespace llvm { +class MemoryBuffer; +} + +namespace lldb_private { + +class DataBufferLLVM : public DataBuffer { +public: + ~DataBufferLLVM(); + + static std::shared_ptr + CreateFromPath(llvm::StringRef Path, uint64_t Size, uint64_t Offset); + static std::shared_ptr + CreateFromFileSpec(const FileSpec &F, uint64_t Size, uint64_t Offset); + + uint8_t *GetBytes() override; + const uint8_t *GetBytes() const override; + lldb::offset_t GetByteSize() const override; + +private: + /// \brief Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a + /// valid pointer. + explicit DataBufferLLVM(std::unique_ptr Buffer); + const uint8_t *GetBuffer() const; + + std::unique_ptr Buffer; +}; +} + +#endif Removed: lldb/trunk/include/lldb/Core/DataBufferMemoryMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/DataBufferMemoryMap.h?rev=296158&view=auto == --- lldb/trunk/include/lldb/Core/DataBufferMemoryMap.h (original) +++ lldb/trunk/include/lldb/Core/DataBufferMemoryMap.h (removed) @@ -1,154 +0,0 @@ -//===-- DataBufferMemoryMap.h ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#ifndef liblldb_DataBufferMemoryMap_h_ -#define liblldb_DataBufferMemoryMap_h_ - -#include "lldb/Core/DataBuffer.h" -#include "lldb/Utility/Error.h" -#include "lldb/lldb-private.h" -#include - -namespace lldb_private { - -//-
[Lldb-commits] [PATCH] D30272: Improve data formatter for libstdcpp unique_ptr
jingham added a comment. I also thought about having the synthetic child provider mark up the special child value objects when it made them. It bugs me a little but that you couldn't, for instance, have a synthetic child provider that doesn't display a child that is the result of the dereference in its view, but provides one when you do the dereference. And it looks like we're creating a system where we have somebody - the SCP - that knows what the dereference means to it, but then we lose the connection to that knowledge when we hand it out. Explain a bit more why you need to create a copy? Anything that makes two versions of the same value that we have to keep in sync makes me nervous. For instance, one of the things we want to do in the future is make write-back possible for synthetic children. That would allow you to change values of std::vector elements in the Locals view of a GUI debugger (which would naturally be based on SBValues) just like you can with the non-synthetic SBValues. Also, how would the SCP know to update this copy when you've stepped in the debugger and the dereference now points to another pointee? https://reviews.llvm.org/D30272 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r296238 - DataBufferMemoryMap.cpp out, DataBufferLLVM.cpp in. Unbreak the build.
Author: jmolenda Date: Fri Feb 24 22:06:09 2017 New Revision: 296238 URL: http://llvm.org/viewvc/llvm-project?rev=296238&view=rev Log: DataBufferMemoryMap.cpp out, DataBufferLLVM.cpp in. Unbreak the build. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=296238&r1=296237&r2=296238&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Feb 24 22:06:09 2017 @@ -401,7 +401,6 @@ 2689003213353E0400698AC0 /* Communication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E6E10F1B85900F91463 /* Communication.cpp */; }; 2689003313353E0400698AC0 /* Connection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E6F10F1B85900F91463 /* Connection.cpp */; }; 2689003613353E0400698AC0 /* DataBufferHeap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7210F1B85900F91463 /* DataBufferHeap.cpp */; }; - 2689003713353E0400698AC0 /* DataBufferMemoryMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7310F1B85900F91463 /* DataBufferMemoryMap.cpp */; }; 2689003813353E0400698AC0 /* DataExtractor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7110F1B85900F91463 /* DataExtractor.cpp */; }; 2689003913353E0400698AC0 /* Debugger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263664921140A4930075843B /* Debugger.cpp */; }; 2689003A13353E0400698AC0 /* Disassembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7610F1B85900F91463 /* Disassembler.cpp */; }; @@ -947,6 +946,7 @@ AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = AF90106315AB7C5700FF120D /* lldb.1 */; }; AF9107EE168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9107EC168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp */; }; AF9107EF168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9107EC168570D200DBCD3C /* RegisterContextDarwin_arm64.cpp */; }; + AF9AC66E1E613C5200604DF0 /* DataBufferLLVM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9AC66D1E613C5200604DF0 /* DataBufferLLVM.cpp */; }; AF9B8F33182DB52900DA866F /* SystemRuntimeMacOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF9B8F31182DB52900DA866F /* SystemRuntimeMacOSX.cpp */; }; AFAFD80A1E57E1B90017A14F /* ModuleCacheTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFAFD8091E57E1B90017A14F /* ModuleCacheTest.cpp */; }; AFB3D2801AC262AB003B4B30 /* MICmdCmdGdbShow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AFB3D27E1AC262AB003B4B30 /* MICmdCmdGdbShow.cpp */; }; @@ -2049,12 +2049,10 @@ 26BC7D5910F1B77400F91463 /* DataBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataBuffer.h; path = include/lldb/Core/DataBuffer.h; sourceTree = ""; }; 26BC7D5A10F1B77400F91463 /* DataExtractor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataExtractor.h; path = include/lldb/Core/DataExtractor.h; sourceTree = ""; }; 26BC7D5B10F1B77400F91463 /* DataBufferHeap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataBufferHeap.h; path = include/lldb/Core/DataBufferHeap.h; sourceTree = ""; }; - 26BC7D5C10F1B77400F91463 /* DataBufferMemoryMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataBufferMemoryMap.h; path = include/lldb/Core/DataBufferMemoryMap.h; sourceTree = ""; }; 26BC7D5E10F1B77400F91463 /* Disassembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Disassembler.h; path = include/lldb/Core/Disassembler.h; sourceTree = ""; }; 26BC7D5F10F1B77400F91463 /* dwarf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dwarf.h; path = include/lldb/Core/dwarf.h; sourceTree = ""; }; 26BC7D6110F1B77400F91463 /* Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Event.h; path = include/lldb/Core/Event.h; sourceTree = ""; }; 26BC7D6310F1B77400F91463 /* FileSpecList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileSpecList.h; path = include/lldb/Core/FileSpecList.h; sourceTree = ""; }; - 26BC7D6410F1B77400F91463 /* Flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType
[Lldb-commits] [lldb] r296243 - Three LoadLibCxxFormatters formatters were given a regex string to
Author: jmolenda Date: Fri Feb 24 23:43:51 2017 New Revision: 296243 URL: http://llvm.org/viewvc/llvm-project?rev=296243&view=rev Log: Three LoadLibCxxFormatters formatters were given a regex string to match but the 'is_regex' argument was not passed as true. Not sure this is causing a bug, but noticed it while working on another bug. These formatters gained a regex in r274489 for NDK but didn't pick up the is_regex flag at the time. Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp?rev=296243&r1=296242&r2=296243&view=diff == --- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Fri Feb 24 23:43:51 2017 @@ -624,14 +624,14 @@ static void LoadLibCxxFormatters(lldb::T lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEndCreator, "libc++ std::vector synthetic children", ConstString("std::__(ndk)?1::vector >"), - stl_synth_flags); + stl_synth_flags, true); AddCXXSynthetic( cpp_category_sp, lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEndCreator, "libc++ std::vector synthetic children", ConstString( "std::__(ndk)?1::vector >"), - stl_synth_flags); + stl_synth_flags, true); AddCXXSynthetic( cpp_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, @@ -765,7 +765,7 @@ static void LoadLibCxxFormatters(lldb::T "libc++ std::vector summary provider", ConstString( "std::__(ndk)?1::vector >"), - stl_summary_flags); + stl_summary_flags, true); AddCXXSynthetic( cpp_category_sp, lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEndCreator, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D30374: Support NetBSD Thread ID in lldb-server
krytarowski created this revision. krytarowski added a project: LLDB. Native Thread ID is retrieved with _lwp_self() on NetBSD. The returned value is of type int32_t, but for consistency with other Operating Systems cast it to uint64_t. Sponsored by Repository: rL LLVM https://reviews.llvm.org/D30374 Files: packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp packages/Python/lldbsuite/test/tools/lldb-server/main.cpp Index: packages/Python/lldbsuite/test/tools/lldb-server/main.cpp === --- packages/Python/lldbsuite/test/tools/lldb-server/main.cpp +++ packages/Python/lldbsuite/test/tools/lldb-server/main.cpp @@ -27,6 +27,8 @@ int pthread_threadid_np(pthread_t, __uint64_t *); #elif defined(__linux__) #include +#elif defined(__NetBSD__) +#include #endif static const char *const RETVAL_PREFIX = "retval:"; @@ -71,6 +73,9 @@ #elif defined(__linux__) // This is a call to gettid() via syscall. printf("%" PRIx64, static_cast(syscall(__NR_gettid))); +#elif defined(__NetBSD__) + // Technically lwpid_t is 32-bit signed integer + printf("%" PRIx64, static_cast(_lwp_self())); #else printf("{no-tid-support}"); #endif Index: packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp === --- packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp +++ packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp @@ -18,6 +18,8 @@ int pthread_threadid_np(pthread_t, __uint64_t *); #elif defined(__linux__) #include +#elif defined(__NetBSD__) +#include #endif static const char *const RETVAL_PREFIX = "retval:"; @@ -62,6 +64,9 @@ #elif defined(__linux__) // This is a call to gettid() via syscall. printf("%" PRIx64, static_cast(syscall(__NR_gettid))); +#elif defined(__NetBSD__) + // Technically lwpid_t is 32-bit signed integer + printf("%" PRIx64, static_cast(_lwp_self())); #else printf("{no-tid-support}"); #endif Index: packages/Python/lldbsuite/test/tools/lldb-server/main.cpp === --- packages/Python/lldbsuite/test/tools/lldb-server/main.cpp +++ packages/Python/lldbsuite/test/tools/lldb-server/main.cpp @@ -27,6 +27,8 @@ int pthread_threadid_np(pthread_t, __uint64_t *); #elif defined(__linux__) #include +#elif defined(__NetBSD__) +#include #endif static const char *const RETVAL_PREFIX = "retval:"; @@ -71,6 +73,9 @@ #elif defined(__linux__) // This is a call to gettid() via syscall. printf("%" PRIx64, static_cast(syscall(__NR_gettid))); +#elif defined(__NetBSD__) + // Technically lwpid_t is 32-bit signed integer + printf("%" PRIx64, static_cast(_lwp_self())); #else printf("{no-tid-support}"); #endif Index: packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp === --- packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp +++ packages/Python/lldbsuite/test/tools/lldb-server/exit-code/main.cpp @@ -18,6 +18,8 @@ int pthread_threadid_np(pthread_t, __uint64_t *); #elif defined(__linux__) #include +#elif defined(__NetBSD__) +#include #endif static const char *const RETVAL_PREFIX = "retval:"; @@ -62,6 +64,9 @@ #elif defined(__linux__) // This is a call to gettid() via syscall. printf("%" PRIx64, static_cast(syscall(__NR_gettid))); +#elif defined(__NetBSD__) + // Technically lwpid_t is 32-bit signed integer + printf("%" PRIx64, static_cast(_lwp_self())); #else printf("{no-tid-support}"); #endif ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits