[lldb-dev] Question about breakpoint hit counts

Zachary Turner zturner at google.com
Wed Jan 14 13:28:08 PST 2015


When I hit a breakpoint on Windows, I'm doing something like this:

        BreakpointSiteSP site(GetBreakpointSiteList().FindByAddress(pc));
        lldb::break_id_t break_id = LLDB_INVALID_BREAK_ID;
        bool should_stop = true;
        if (site)
        {
            should_stop = site->ValidForThisThread(stop_thread.get());
            break_id = site->GetID();
        }

        stop_info =
StopInfo::CreateStopReasonWithBreakpointSiteID(*stop_thread, break_id,
should_stop);
        stop_thread->SetStopInfo(stop_info);

When should_stop is true (which for now is basically always), this results
in the breakpoint's hit count not increasing.  It seems this is because
specifying a value for should_stop leads to m_should_stop_is_valid being
initialized to true.  But in StopInfoBreakpoint::ShouldStopSynchronous(),
we only bump the hit count if m_should_stop_is_valid is false.

I can fix this bug by using

StopInfo::CreateStopReasonWithBreakpointSiteID(*stop_thread, break_id);

instead, and since m_stop_info_is_valid is false, and it bumps the hit
count later.  But I'm not sure if this is the right thing to do, or if the
behavior I'm seeing with specifying a value for should_stop on creation and
the hit count not going up is a bug.

Can anyone explain this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150114/1e566a7a/attachment.html>


More information about the lldb-dev mailing list