summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/DNB.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-06-12 00:46:38 +0000
committerGreg Clayton <gclayton@apple.com>2013-06-12 00:46:38 +0000
commitd8cf1a119d4c38e59ade90018a4df015dff63383 (patch)
tree606b745e59a29f527781d29bd8709ff5e8a814f1 /lldb/tools/debugserver/source/DNB.cpp
parentec36f9a73429dda07049473625d3354b209cc5b7 (diff)
downloadbcm5719-llvm-d8cf1a119d4c38e59ade90018a4df015dff63383.tar.gz
bcm5719-llvm-d8cf1a119d4c38e59ade90018a4df015dff63383.zip
Huge performance improvements when one breakpoint contains many locations.
325,000 breakpoints for running "breakpoint set --func-regex ." on lldb itself (after hitting a breakpoint at main so that LLDB.framework is loaded) used to take up to an hour to set, now we are down under a minute. With warm file caches, we are at 40 seconds, and that is with setting 325,000 breakpoint through the GDB remote API. Linux and the native debuggers might be faster. I haven't timed what how much is debug info parsing and how much is the protocol traffic to/from GDB remote. That there were many performance issues. Most of them were due to storing breakpoints in the wrong data structures, or using the wrong iterators to traverse the lists, traversing the lists in inefficient ways, and not optimizing certain function name lookups/symbol merges correctly. Debugging after that is also now very efficient. There were issues with replacing the breakpoint opcodes in memory that was read, and those routines were also fixed. llvm-svn: 183820
Diffstat (limited to 'lldb/tools/debugserver/source/DNB.cpp')
-rw-r--r--lldb/tools/debugserver/source/DNB.cpp205
1 files changed, 11 insertions, 194 deletions
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp
index b91452a28c1..bcbcf983ff7 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -901,227 +901,44 @@ DNBProcessResetEvents (nub_process_t pid, nub_event_t event_mask)
}
// Breakpoints
-nub_break_t
+nub_bool_t
DNBBreakpointSet (nub_process_t pid, nub_addr_t addr, nub_size_t size, nub_bool_t hardware)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
- {
- return procSP->CreateBreakpoint(addr, size, hardware, THREAD_NULL);
- }
- return INVALID_NUB_BREAK_ID;
-}
-
-nub_bool_t
-DNBBreakpointClear (nub_process_t pid, nub_break_t breakID)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- return procSP->DisableBreakpoint(breakID, true);
- }
- }
- return false; // Failed
-}
-
-nub_ssize_t
-DNBBreakpointGetHitCount (nub_process_t pid, nub_break_t breakID)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Breakpoints().FindByID(breakID);
- if (bp)
- return bp->GetHitCount();
- }
- }
- return 0;
-}
-
-nub_ssize_t
-DNBBreakpointGetIgnoreCount (nub_process_t pid, nub_break_t breakID)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Breakpoints().FindByID(breakID);
- if (bp)
- return bp->GetIgnoreCount();
- }
- }
- return 0;
-}
-
-nub_bool_t
-DNBBreakpointSetIgnoreCount (nub_process_t pid, nub_break_t breakID, nub_size_t ignore_count)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Breakpoints().FindByID(breakID);
- if (bp)
- {
- bp->SetIgnoreCount(ignore_count);
- return true;
- }
- }
- }
+ return procSP->CreateBreakpoint(addr, size, hardware) != NULL;
return false;
}
-// Set the callback function for a given breakpoint. The callback function will
-// get called as soon as the breakpoint is hit. The function will be called
-// with the process ID, thread ID, breakpoint ID and the baton, and can return
-//
nub_bool_t
-DNBBreakpointSetCallback (nub_process_t pid, nub_break_t breakID, DNBCallbackBreakpointHit callback, void *baton)
-{
- if (NUB_BREAK_ID_IS_VALID(breakID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Breakpoints().FindByID(breakID);
- if (bp)
- {
- bp->SetCallback(callback, baton);
- return true;
- }
- }
- }
- return false;
-}
-
-//----------------------------------------------------------------------
-// Dump the breakpoints stats for process PID for a breakpoint by ID.
-//----------------------------------------------------------------------
-void
-DNBBreakpointPrint (nub_process_t pid, nub_break_t breakID)
+DNBBreakpointClear (nub_process_t pid, nub_addr_t addr)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
- procSP->DumpBreakpoint(breakID);
+ return procSP->DisableBreakpoint(addr, true);
+ return false; // Failed
}
+
//----------------------------------------------------------------------
// Watchpoints
//----------------------------------------------------------------------
-nub_watch_t
+nub_bool_t
DNBWatchpointSet (nub_process_t pid, nub_addr_t addr, nub_size_t size, uint32_t watch_flags, nub_bool_t hardware)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
- {
- return procSP->CreateWatchpoint(addr, size, watch_flags, hardware, THREAD_NULL);
- }
- return INVALID_NUB_WATCH_ID;
-}
-
-nub_bool_t
-DNBWatchpointClear (nub_process_t pid, nub_watch_t watchID)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- return procSP->DisableWatchpoint(watchID, true);
- }
- }
- return false; // Failed
-}
-
-nub_ssize_t
-DNBWatchpointGetHitCount (nub_process_t pid, nub_watch_t watchID)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Watchpoints().FindByID(watchID);
- if (bp)
- return bp->GetHitCount();
- }
- }
- return 0;
-}
-
-nub_ssize_t
-DNBWatchpointGetIgnoreCount (nub_process_t pid, nub_watch_t watchID)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Watchpoints().FindByID(watchID);
- if (bp)
- return bp->GetIgnoreCount();
- }
- }
- return 0;
-}
-
-nub_bool_t
-DNBWatchpointSetIgnoreCount (nub_process_t pid, nub_watch_t watchID, nub_size_t ignore_count)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Watchpoints().FindByID(watchID);
- if (bp)
- {
- bp->SetIgnoreCount(ignore_count);
- return true;
- }
- }
- }
+ return procSP->CreateWatchpoint(addr, size, watch_flags, hardware) != NULL;
return false;
}
-// Set the callback function for a given watchpoint. The callback function will
-// get called as soon as the watchpoint is hit. The function will be called
-// with the process ID, thread ID, watchpoint ID and the baton, and can return
-//
nub_bool_t
-DNBWatchpointSetCallback (nub_process_t pid, nub_watch_t watchID, DNBCallbackBreakpointHit callback, void *baton)
-{
- if (NUB_WATCH_ID_IS_VALID(watchID))
- {
- MachProcessSP procSP;
- if (GetProcessSP (pid, procSP))
- {
- DNBBreakpoint *bp = procSP->Watchpoints().FindByID(watchID);
- if (bp)
- {
- bp->SetCallback(callback, baton);
- return true;
- }
- }
- }
- return false;
-}
-
-//----------------------------------------------------------------------
-// Dump the watchpoints stats for process PID for a watchpoint by ID.
-//----------------------------------------------------------------------
-void
-DNBWatchpointPrint (nub_process_t pid, nub_watch_t watchID)
+DNBWatchpointClear (nub_process_t pid, nub_addr_t addr)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
- procSP->DumpWatchpoint(watchID);
+ return procSP->DisableWatchpoint(addr, true);
+ return false; // Failed
}
//----------------------------------------------------------------------
OpenPOWER on IntegriCloud