Skip to content

Commit 4471e44

Browse files
authored
Merge pull request #6773 from jasonmolenda/addressing_bits-in-stop-reply-packet2-59
Recognize `addressing_bits` kv in stop reply packet
2 parents 713e745 + 0ea7e70 commit 4471e44

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lldb/docs/lldb-gdb-remote.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,24 @@ for this region.
15961596
// Example:
15971597
// thread-pcs:dec14,2cf872b0,2cf8681c,2d02d68c,2cf716a8;
15981598
//
1599+
// "addressing_bits" unsigned optional Specifies how many bits in addresses
1600+
// are significant for addressing, base
1601+
// 10. If bits 38..0 in a 64-bit
1602+
// pointer are significant for
1603+
// addressing, then the value is 39.
1604+
// This is needed on e.g. AArch64
1605+
// v8.3 ABIs that use pointer
1606+
// authentication in the high bits.
1607+
// This value is normally sent in the
1608+
// qHostInfo packet response, and if the
1609+
// value cannot change during the process
1610+
// lifetime, it does not need to be
1611+
// duplicated here in the stop packet.
1612+
// For a firmware environment with early
1613+
// start code that may be changing the
1614+
// page table setup, a dynamically set
1615+
// value may be needed.
1616+
//
15991617
// BEST PRACTICES:
16001618
// Since register values can be supplied with this packet, it is often useful
16011619
// to return the PC, SP, FP, LR (if any), and FLAGS registers so that separate

lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,6 +2238,13 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) {
22382238
StreamString ostr;
22392239
ostr.Printf("%" PRIu64 " %" PRIu64, pid_tid->first, pid_tid->second);
22402240
description = std::string(ostr.GetString());
2241+
} else if (key.compare("addressing_bits") == 0) {
2242+
uint64_t addressing_bits;
2243+
if (!value.getAsInteger(0, addressing_bits)) {
2244+
addr_t address_mask = ~((1ULL << addressing_bits) - 1);
2245+
SetCodeAddressMask(address_mask);
2246+
SetDataAddressMask(address_mask);
2247+
}
22412248
} else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1])) {
22422249
uint32_t reg = UINT32_MAX;
22432250
if (!key.getAsInteger(16, reg))

0 commit comments

Comments
 (0)