Skip to content

Commit 572a8dc

Browse files
Log breakpoints and addresses when printing ThreadPLans at ShouldStop
1 parent c89ea13 commit 572a8dc

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

lldb/source/Target/Thread.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,19 +805,31 @@ bool Thread::ShouldStop(Event *event_ptr) {
805805
SetShouldRunBeforePublicStop(false);
806806

807807
if (log) {
808+
auto &sc =
809+
GetStackFrameAtIndex(0)->GetSymbolContext(eSymbolContextEverything);
810+
auto *funcname = sc.GetFunctionName(Mangled::ePreferMangled).AsCString();
808811
LLDB_LOGF(log,
809812
"Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
810-
", pc = 0x%16.16" PRIx64,
813+
", pc = 0x%16.16" PRIx64 " (%s)",
811814
__FUNCTION__, static_cast<void *>(this), GetID(), GetProtocolID(),
812815
GetRegisterContext() ? GetRegisterContext()->GetPC()
813-
: LLDB_INVALID_ADDRESS);
816+
: LLDB_INVALID_ADDRESS,
817+
funcname);
814818
LLDB_LOGF(log, "^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
815819
StreamString s;
816820
s.IndentMore();
817821
GetProcess()->DumpThreadPlansForTID(
818822
s, GetID(), eDescriptionLevelVerbose, true /* internal */,
819823
false /* condense_trivial */, true /* skip_unreported */);
820824
LLDB_LOGF(log, "Plan stack initial state:\n%s", s.GetData());
825+
s.Clear();
826+
auto &external_bps = this->CalculateTarget()->GetBreakpointList(false);
827+
for (const auto &bp : external_bps.Breakpoints())
828+
bp->GetDescription(&s, lldb::DescriptionLevel::eDescriptionLevelFull);
829+
auto &internal_bps = this->CalculateTarget()->GetBreakpointList(true);
830+
for (const auto &bp : internal_bps.Breakpoints())
831+
bp->GetDescription(&s, lldb::DescriptionLevel::eDescriptionLevelFull);
832+
LLDB_LOGF(log, "Current breakpoints:\n%s", s.GetData());
821833
}
822834

823835
// The top most plan always gets to do the trace log...
@@ -993,6 +1005,14 @@ bool Thread::ShouldStop(Event *event_ptr) {
9931005
LLDB_LOGF(log, "Plan stack final state:\n%s", s.GetData());
9941006
LLDB_LOGF(log, "vvvvvvvv Thread::ShouldStop End (returning %i) vvvvvvvv",
9951007
should_stop);
1008+
s.Clear();
1009+
auto &external_bps = this->CalculateTarget()->GetBreakpointList(false);
1010+
for (const auto &bp : external_bps.Breakpoints())
1011+
bp->GetDescription(&s, lldb::DescriptionLevel::eDescriptionLevelFull);
1012+
auto &internal_bps = this->CalculateTarget()->GetBreakpointList(true);
1013+
for (const auto &bp : internal_bps.Breakpoints())
1014+
bp->GetDescription(&s, lldb::DescriptionLevel::eDescriptionLevelFull);
1015+
LLDB_LOGF(log, "Current breakpoints:\n%s", s.GetData());
9961016
}
9971017
return should_stop;
9981018
}

lldb/source/Target/ThreadPlanStepOut.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,24 +277,22 @@ void ThreadPlanStepOut::GetDescription(Stream *s,
277277
s->Printf("Stepping out by stepping through inlined function.");
278278
else {
279279
s->Printf("Stepping out from ");
280+
s->Printf("address 0x%" PRIx64 " ", (uint64_t)m_step_from_insn);
280281
Address tmp_address;
281282
if (tmp_address.SetLoadAddress(m_step_from_insn, &GetTarget())) {
282283
tmp_address.Dump(s, &m_process, Address::DumpStyleResolvedDescription,
283284
Address::DumpStyleLoadAddress);
284-
} else {
285-
s->Printf("address 0x%" PRIx64 "", (uint64_t)m_step_from_insn);
286285
}
287286

288287
// FIXME: find some useful way to present the m_return_id, since there may
289288
// be multiple copies of the
290289
// same function on the stack.
291290

292291
s->Printf(" returning to frame at ");
292+
s->Printf("address 0x%" PRIx64 " ", (uint64_t)m_return_addr);
293293
if (tmp_address.SetLoadAddress(m_return_addr, &GetTarget())) {
294294
tmp_address.Dump(s, &m_process, Address::DumpStyleResolvedDescription,
295295
Address::DumpStyleLoadAddress);
296-
} else {
297-
s->Printf("address 0x%" PRIx64 "", (uint64_t)m_return_addr);
298296
}
299297

300298
if (level == eDescriptionLevelVerbose)

0 commit comments

Comments
 (0)