summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2013-03-01 00:43:19 +0000
committerJason Molenda <jmolenda@apple.com>2013-03-01 00:43:19 +0000
commitce62fd72f6020d44a7d72fde40d9de6eb68bd7a7 (patch)
tree043dbcbccdf25add8a0b6744f1c2b156267324c4 /lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
parentf815db5bcb53b4675a3a4c9604d5152a6ae6a58c (diff)
downloadbcm5719-llvm-ce62fd72f6020d44a7d72fde40d9de6eb68bd7a7.tar.gz
bcm5719-llvm-ce62fd72f6020d44a7d72fde40d9de6eb68bd7a7.zip
Patch from Andrew Fish to add recognition of some additional
KDP packets. llvm-svn: 176319
Diffstat (limited to 'lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp')
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp148
1 files changed, 146 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
index efebc8606d6..c98b2465fdb 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
@@ -320,6 +320,13 @@ CommunicationKDP::CheckForPacket (const uint8_t *src, size_t src_len, DataExtrac
case ePacketTypeReply | KDP_BREAKPOINT_SET64:
case ePacketTypeReply | KDP_BREAKPOINT_REMOVE64:
case ePacketTypeReply | KDP_KERNELVERSION:
+ case ePacketTypeReply | KDP_READPHYSMEM64:
+ case ePacketTypeReply | KDP_WRITEPHYSMEM64:
+ case ePacketTypeReply | KDP_READIOPORT:
+ case ePacketTypeReply | KDP_WRITEIOPORT:
+ case ePacketTypeReply | KDP_READMSR64:
+ case ePacketTypeReply | KDP_WRITEMSR64:
+ case ePacketTypeReply | KDP_DUMPINFO:
{
offset = 2;
const uint16_t length = packet.GetU16 (&offset);
@@ -727,7 +734,7 @@ CommunicationKDP::SendRawRequest (uint8_t command_byte,
{
lldb::offset_t offset = 8;
uint32_t kdp_error = reply_packet.GetU32 (&offset);
- if (kdp_error)
+ if (kdp_error && (command_byte != KDP_DUMPINFO))
error.SetErrorStringWithFormat ("request packet 0x%8.8x failed (error %u)", command_byte, kdp_error);
else
{
@@ -773,6 +780,13 @@ CommunicationKDP::GetCommandAsCString (uint8_t command)
case KDP_BREAKPOINT_SET64: return "KDP_BREAKPOINT64_SET";
case KDP_BREAKPOINT_REMOVE64: return "KDP_BREAKPOINT64_REMOVE";
case KDP_KERNELVERSION: return "KDP_KERNELVERSION";
+ case KDP_READPHYSMEM64: return "KDP_READPHYSMEM64";
+ case KDP_WRITEPHYSMEM64: return "KDP_WRITEPHYSMEM64";
+ case KDP_READIOPORT: return "KDP_READIOPORT";
+ case KDP_WRITEIOPORT: return "KDP_WRITEIOPORT";
+ case KDP_READMSR64: return "KDP_READMSR64";
+ case KDP_WRITEMSR64: return "KDP_WRITEMSR64";
+ case KDP_DUMPINFO: return "KDP_DUMPINFO";
}
return NULL;
}
@@ -828,6 +842,8 @@ CommunicationKDP::DumpPacket (Stream &s, const DataExtractor& packet)
case KDP_BREAKPOINT_REMOVE64:
case KDP_WRITEREGS:
case KDP_LOAD:
+ case KDP_WRITEIOPORT:
+ case KDP_WRITEMSR64:
{
const uint32_t error = packet.GetU32 (&offset);
s.Printf(" (error=0x%8.8x)", error);
@@ -878,6 +894,7 @@ CommunicationKDP::DumpPacket (Stream &s, const DataExtractor& packet)
case KDP_READMEM:
case KDP_READMEM64:
+ case KDP_READPHYSMEM64:
{
const uint32_t error = packet.GetU32 (&offset);
const uint32_t count = packet.GetByteSize() - offset;
@@ -930,6 +947,41 @@ CommunicationKDP::DumpPacket (Stream &s, const DataExtractor& packet)
s.Printf(" (path = \"%s\")", path);
}
break;
+
+ case KDP_READIOPORT:
+ case KDP_READMSR64:
+ {
+ const uint32_t error = packet.GetU32 (&offset);
+ const uint32_t count = packet.GetByteSize() - offset;
+ s.Printf(" (error = 0x%8.8x io:\n", error);
+ if (count > 0)
+ packet.Dump (&s, // Stream to dump to
+ offset, // Offset within "packet"
+ eFormatHex, // Format to use
+ 1, // Size of each item in bytes
+ count, // Number of items
+ 16, // Number per line
+ LLDB_INVALID_ADDRESS, // Don't show addresses before each line
+ 0, 0); // No bitfields
+ }
+ break;
+ case KDP_DUMPINFO:
+ {
+ const uint32_t count = packet.GetByteSize() - offset;
+ s.Printf(" (count = %u, bytes = \n", count);
+ if (count > 0)
+ packet.Dump (&s, // Stream to dump to
+ offset, // Offset within "packet"
+ eFormatHex, // Format to use
+ 1, // Size of each item in bytes
+ count, // Number of items
+ 16, // Number per line
+ LLDB_INVALID_ADDRESS, // Don't show addresses before each line
+ 0, 0); // No bitfields
+
+ }
+ break;
+
default:
s.Printf(" (add support for dumping this packet reply!!!");
break;
@@ -997,6 +1049,16 @@ CommunicationKDP::DumpPacket (Stream &s, const DataExtractor& packet)
}
break;
+ case KDP_READPHYSMEM64:
+ {
+ const uint64_t addr = packet.GetU64 (&offset);
+ const uint32_t size = packet.GetU32 (&offset);
+ const uint32_t lcpu = packet.GetU16 (&offset);
+ s.Printf(" (addr = 0x%16.16llx, size = %u, lcpu = %u)", addr, size, lcpu);
+ m_last_read_memory_addr = addr;
+ }
+ break;
+
case KDP_WRITEMEM64:
{
const uint64_t addr = packet.GetU64 (&offset);
@@ -1007,6 +1069,17 @@ CommunicationKDP::DumpPacket (Stream &s, const DataExtractor& packet)
}
break;
+ case KDP_WRITEPHYSMEM64:
+ {
+ const uint64_t addr = packet.GetU64 (&offset);
+ const uint32_t size = packet.GetU32 (&offset);
+ const uint32_t lcpu = packet.GetU16 (&offset);
+ s.Printf(" (addr = 0x%16.16llx, size = %u, lcpu = %u, bytes = \n", addr, size, lcpu);
+ if (size > 0)
+ DataExtractor::DumpHexBytes(&s, packet.GetData(&offset, size), size, 32, addr);
+ }
+ break;
+
case KDP_READREGS:
{
const uint32_t cpu = packet.GetU32 (&offset);
@@ -1105,7 +1178,78 @@ CommunicationKDP::DumpPacket (Stream &s, const DataExtractor& packet)
s.Printf(" (reply_port = %u)", reply_port);
}
break;
- }
+
+ case KDP_READMSR64:
+ {
+ const uint32_t address = packet.GetU32 (&offset);
+ const uint16_t lcpu = packet.GetU16 (&offset);
+ s.Printf(" (address=0x%8.8x, lcpu=0x%4.4x)", address, lcpu);
+ }
+ break;
+
+ case KDP_WRITEMSR64:
+ {
+ const uint32_t address = packet.GetU32 (&offset);
+ const uint16_t lcpu = packet.GetU16 (&offset);
+ const uint32_t nbytes = packet.GetByteSize() - offset;
+ s.Printf(" (address=0x%8.8x, lcpu=0x%4.4x, nbytes=0x%8.8x)", lcpu, address, nbytes);
+ if (nbytes > 0)
+ packet.Dump (&s, // Stream to dump to
+ offset, // Offset within "packet"
+ eFormatHex, // Format to use
+ 1, // Size of each item in bytes
+ nbytes, // Number of items
+ 16, // Number per line
+ LLDB_INVALID_ADDRESS, // Don't show addresses before each line
+ 0, 0); // No bitfields
+ }
+ break;
+
+ case KDP_READIOPORT:
+ {
+ const uint16_t lcpu = packet.GetU16 (&offset);
+ const uint16_t address = packet.GetU16 (&offset);
+ const uint16_t nbytes = packet.GetU16 (&offset);
+ s.Printf(" (lcpu=0x%4.4x, address=0x%4.4x, nbytes=%u)", lcpu, address, nbytes);
+ }
+ break;
+
+ case KDP_WRITEIOPORT:
+ {
+ const uint16_t lcpu = packet.GetU16 (&offset);
+ const uint16_t address = packet.GetU16 (&offset);
+ const uint16_t nbytes = packet.GetU16 (&offset);
+ s.Printf(" (lcpu = %u, addr = 0x%4.4x, nbytes = %u, bytes = \n", lcpu, address, nbytes);
+ if (nbytes > 0)
+ packet.Dump (&s, // Stream to dump to
+ offset, // Offset within "packet"
+ eFormatHex, // Format to use
+ 1, // Size of each item in bytes
+ nbytes, // Number of items
+ 16, // Number per line
+ LLDB_INVALID_ADDRESS, // Don't show addresses before each line
+ 0, 0); // No bitfields
+ }
+ break;
+
+ case KDP_DUMPINFO:
+ {
+ const uint32_t count = packet.GetByteSize() - offset;
+ s.Printf(" (count = %u, bytes = \n", count);
+ if (count > 0)
+ packet.Dump (&s, // Stream to dump to
+ offset, // Offset within "packet"
+ eFormatHex, // Format to use
+ 1, // Size of each item in bytes
+ count, // Number of items
+ 16, // Number per line
+ LLDB_INVALID_ADDRESS, // Don't show addresses before each line
+ 0, 0); // No bitfields
+
+ }
+ break;
+
+ }
}
}
else
OpenPOWER on IntegriCloud