summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-08-15 00:23:45 -0400
committerGravatar Lioncash2018-08-15 01:05:50 -0400
commite0b0f4eece7e9ef5b4223056d622c5ce13836151 (patch)
treeda08d7f7464171dd8ab33759372c0fc62f2611fe
parentMerge pull request #1067 from lioncash/init (diff)
downloadyuzu-e0b0f4eece7e9ef5b4223056d622c5ce13836151.tar.gz
yuzu-e0b0f4eece7e9ef5b4223056d622c5ce13836151.tar.xz
yuzu-e0b0f4eece7e9ef5b4223056d622c5ce13836151.zip
lm: Handle threads and modules within the logger
The thread field serves to indicate which thread a log is related to and provides the length of the thread's name, so we can print that out, ditto for modules. Now we can know what threads are potentially spawning off logging messages (for example Lydie & Suelle bounces between MainThread and LoadingThread when initializing the game).
-rw-r--r--src/core/hle/service/lm/lm.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp
index 2e99ddf51..7d054fc43 100644
--- a/src/core/hle/service/lm/lm.cpp
+++ b/src/core/hle/service/lm/lm.cpp
@@ -92,7 +92,11 @@ private:
92 92
93 // Parse out log metadata 93 // Parse out log metadata
94 u32 line{}; 94 u32 line{};
95 std::string message, filename, function; 95 std::string module;
96 std::string message;
97 std::string filename;
98 std::string function;
99 std::string thread;
96 while (addr < end_addr) { 100 while (addr < end_addr) {
97 const Field field{static_cast<Field>(Memory::Read8(addr++))}; 101 const Field field{static_cast<Field>(Memory::Read8(addr++))};
98 const size_t length{Memory::Read8(addr++)}; 102 const size_t length{Memory::Read8(addr++)};
@@ -102,6 +106,8 @@ private:
102 } 106 }
103 107
104 switch (field) { 108 switch (field) {
109 case Field::Skip:
110 break;
105 case Field::Message: 111 case Field::Message:
106 message = Memory::ReadCString(addr, length); 112 message = Memory::ReadCString(addr, length);
107 break; 113 break;
@@ -114,6 +120,12 @@ private:
114 case Field::Function: 120 case Field::Function:
115 function = Memory::ReadCString(addr, length); 121 function = Memory::ReadCString(addr, length);
116 break; 122 break;
123 case Field::Module:
124 module = Memory::ReadCString(addr, length);
125 break;
126 case Field::Thread:
127 thread = Memory::ReadCString(addr, length);
128 break;
117 } 129 }
118 130
119 addr += length; 131 addr += length;
@@ -128,12 +140,18 @@ private:
128 if (!filename.empty()) { 140 if (!filename.empty()) {
129 log_stream << filename << ':'; 141 log_stream << filename << ':';
130 } 142 }
143 if (!module.empty()) {
144 log_stream << module << ':';
145 }
131 if (!function.empty()) { 146 if (!function.empty()) {
132 log_stream << function << ':'; 147 log_stream << function << ':';
133 } 148 }
134 if (line) { 149 if (line) {
135 log_stream << std::to_string(line) << ':'; 150 log_stream << std::to_string(line) << ':';
136 } 151 }
152 if (!thread.empty()) {
153 log_stream << thread << ':';
154 }
137 if (log_stream.str().length() > 0 && log_stream.str().back() == ':') { 155 if (log_stream.str().length() > 0 && log_stream.str().back() == ':') {
138 log_stream << ' '; 156 log_stream << ' ';
139 } 157 }