aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2022-08-17 13:58:28 +0000
committerDavid Spickett <david.spickett@linaro.org>2022-09-20 09:02:17 +0000
commitba822e248d3a41aa334eb1b79396364ee251c10c (patch)
tree44b24c4152d4b3af492f1a8dd3acac6ecc8aa601 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
parent2aad9093ac6b8c592341ce1756cb63422029b92b (diff)
downloadllvm-ba822e248d3a41aa334eb1b79396364ee251c10c.zip
llvm-ba822e248d3a41aa334eb1b79396364ee251c10c.tar.gz
llvm-ba822e248d3a41aa334eb1b79396364ee251c10c.tar.bz2
[LLDB] Format lldb-server's target XML
So that the XML isn't one giant line. Which wasn't a problem for lldb but was for me trying to troubleshoot it using the logs. It now looks like: ``` <?xml version="1.0"?> <target version="1.0"> <architecture>aarch64</architecture> <feature> <...> <reg name="fpcr" .../> </feature> </target> ``` Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134035
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 072151e..4ea8472 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -3066,19 +3066,24 @@ GDBRemoteCommunicationServerLLGS::BuildTargetXml() {
StreamString response;
- response.Printf("<?xml version=\"1.0\"?>");
- response.Printf("<target version=\"1.0\">");
+ response.Printf("<?xml version=\"1.0\"?>\n");
+ response.Printf("<target version=\"1.0\">\n");
+ response.IndentMore();
- response.Printf("<architecture>%s</architecture>",
+ response.Indent();
+ response.Printf("<architecture>%s</architecture>\n",
m_current_process->GetArchitecture()
.GetTriple()
.getArchName()
.str()
.c_str());
- response.Printf("<feature>");
+ response.Indent("<feature>\n");
const int registers_count = reg_context.GetUserRegisterCount();
+ if (registers_count)
+ response.IndentMore();
+
for (int reg_index = 0; reg_index < registers_count; reg_index++) {
const RegisterInfo *reg_info =
reg_context.GetRegisterInfoAtIndex(reg_index);
@@ -3090,7 +3095,9 @@ GDBRemoteCommunicationServerLLGS::BuildTargetXml() {
continue;
}
- response.Printf("<reg name=\"%s\" bitsize=\"%" PRIu32 "\" regnum=\"%d\" ",
+ response.Indent();
+ response.Printf("<reg name=\"%s\" bitsize=\"%" PRIu32
+ "\" regnum=\"%d\" ",
reg_info->name, reg_info->byte_size * 8, reg_index);
if (!reg_context.RegisterOffsetIsDynamic())
@@ -3139,11 +3146,15 @@ GDBRemoteCommunicationServerLLGS::BuildTargetXml() {
response.Printf("\" ");
}
- response.Printf("/>");
+ response.Printf("/>\n");
}
- response.Printf("</feature>");
- response.Printf("</target>");
+ if (registers_count)
+ response.IndentLess();
+
+ response.Indent("</feature>\n");
+ response.IndentLess();
+ response.Indent("</target>\n");
return MemoryBuffer::getMemBufferCopy(response.GetString(), "target.xml");
}