summaryrefslogtreecommitdiff
path: root/src/core/debugger/gdbstub.cpp
diff options
context:
space:
mode:
authorGravatar liamwhite2023-03-27 12:16:40 -0400
committerGravatar GitHub2023-03-27 12:16:40 -0400
commit0661f5ccd1704935dc9c49521a79cc26832db3b0 (patch)
treee0923dd40e8dd0f6ec92a2de7722f911bd26c514 /src/core/debugger/gdbstub.cpp
parentMerge pull request #9995 from german77/plain (diff)
parentmemory: rename global memory references to application memory (diff)
downloadyuzu-0661f5ccd1704935dc9c49521a79cc26832db3b0.tar.gz
yuzu-0661f5ccd1704935dc9c49521a79cc26832db3b0.tar.xz
yuzu-0661f5ccd1704935dc9c49521a79cc26832db3b0.zip
Merge pull request #9984 from liamwhite/global-memory
memory: rename global memory references to application memory
Diffstat (limited to 'src/core/debugger/gdbstub.cpp')
-rw-r--r--src/core/debugger/gdbstub.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/core/debugger/gdbstub.cpp b/src/core/debugger/gdbstub.cpp
index 5cfb66b93..e2a13bbd2 100644
--- a/src/core/debugger/gdbstub.cpp
+++ b/src/core/debugger/gdbstub.cpp
@@ -261,9 +261,9 @@ void GDBStub::ExecuteCommand(std::string_view packet, std::vector<DebuggerAction
261 const size_t addr{static_cast<size_t>(strtoll(command.data(), nullptr, 16))}; 261 const size_t addr{static_cast<size_t>(strtoll(command.data(), nullptr, 16))};
262 const size_t size{static_cast<size_t>(strtoll(command.data() + sep, nullptr, 16))}; 262 const size_t size{static_cast<size_t>(strtoll(command.data() + sep, nullptr, 16))};
263 263
264 if (system.Memory().IsValidVirtualAddressRange(addr, size)) { 264 if (system.ApplicationMemory().IsValidVirtualAddressRange(addr, size)) {
265 std::vector<u8> mem(size); 265 std::vector<u8> mem(size);
266 system.Memory().ReadBlock(addr, mem.data(), size); 266 system.ApplicationMemory().ReadBlock(addr, mem.data(), size);
267 267
268 SendReply(Common::HexToString(mem)); 268 SendReply(Common::HexToString(mem));
269 } else { 269 } else {
@@ -281,8 +281,8 @@ void GDBStub::ExecuteCommand(std::string_view packet, std::vector<DebuggerAction
281 const auto mem_substr{std::string_view(command).substr(mem_sep)}; 281 const auto mem_substr{std::string_view(command).substr(mem_sep)};
282 const auto mem{Common::HexStringToVector(mem_substr, false)}; 282 const auto mem{Common::HexStringToVector(mem_substr, false)};
283 283
284 if (system.Memory().IsValidVirtualAddressRange(addr, size)) { 284 if (system.ApplicationMemory().IsValidVirtualAddressRange(addr, size)) {
285 system.Memory().WriteBlock(addr, mem.data(), size); 285 system.ApplicationMemory().WriteBlock(addr, mem.data(), size);
286 system.InvalidateCpuInstructionCacheRange(addr, size); 286 system.InvalidateCpuInstructionCacheRange(addr, size);
287 SendReply(GDB_STUB_REPLY_OK); 287 SendReply(GDB_STUB_REPLY_OK);
288 } else { 288 } else {
@@ -325,7 +325,7 @@ void GDBStub::HandleBreakpointInsert(std::string_view command) {
325 const size_t addr{static_cast<size_t>(strtoll(command.data() + addr_sep, nullptr, 16))}; 325 const size_t addr{static_cast<size_t>(strtoll(command.data() + addr_sep, nullptr, 16))};
326 const size_t size{static_cast<size_t>(strtoll(command.data() + size_sep, nullptr, 16))}; 326 const size_t size{static_cast<size_t>(strtoll(command.data() + size_sep, nullptr, 16))};
327 327
328 if (!system.Memory().IsValidVirtualAddressRange(addr, size)) { 328 if (!system.ApplicationMemory().IsValidVirtualAddressRange(addr, size)) {
329 SendReply(GDB_STUB_REPLY_ERR); 329 SendReply(GDB_STUB_REPLY_ERR);
330 return; 330 return;
331 } 331 }
@@ -334,22 +334,22 @@ void GDBStub::HandleBreakpointInsert(std::string_view command) {
334 334
335 switch (type) { 335 switch (type) {
336 case BreakpointType::Software: 336 case BreakpointType::Software:
337 replaced_instructions[addr] = system.Memory().Read32(addr); 337 replaced_instructions[addr] = system.ApplicationMemory().Read32(addr);
338 system.Memory().Write32(addr, arch->BreakpointInstruction()); 338 system.ApplicationMemory().Write32(addr, arch->BreakpointInstruction());
339 system.InvalidateCpuInstructionCacheRange(addr, sizeof(u32)); 339 system.InvalidateCpuInstructionCacheRange(addr, sizeof(u32));
340 success = true; 340 success = true;
341 break; 341 break;
342 case BreakpointType::WriteWatch: 342 case BreakpointType::WriteWatch:
343 success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size, 343 success = system.ApplicationProcess()->InsertWatchpoint(addr, size,
344 Kernel::DebugWatchpointType::Write); 344 Kernel::DebugWatchpointType::Write);
345 break; 345 break;
346 case BreakpointType::ReadWatch: 346 case BreakpointType::ReadWatch:
347 success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size, 347 success = system.ApplicationProcess()->InsertWatchpoint(addr, size,
348 Kernel::DebugWatchpointType::Read); 348 Kernel::DebugWatchpointType::Read);
349 break; 349 break;
350 case BreakpointType::AccessWatch: 350 case BreakpointType::AccessWatch:
351 success = system.ApplicationProcess()->InsertWatchpoint( 351 success = system.ApplicationProcess()->InsertWatchpoint(
352 system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite); 352 addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
353 break; 353 break;
354 case BreakpointType::Hardware: 354 case BreakpointType::Hardware:
355 default: 355 default:
@@ -372,7 +372,7 @@ void GDBStub::HandleBreakpointRemove(std::string_view command) {
372 const size_t addr{static_cast<size_t>(strtoll(command.data() + addr_sep, nullptr, 16))}; 372 const size_t addr{static_cast<size_t>(strtoll(command.data() + addr_sep, nullptr, 16))};
373 const size_t size{static_cast<size_t>(strtoll(command.data() + size_sep, nullptr, 16))}; 373 const size_t size{static_cast<size_t>(strtoll(command.data() + size_sep, nullptr, 16))};
374 374
375 if (!system.Memory().IsValidVirtualAddressRange(addr, size)) { 375 if (!system.ApplicationMemory().IsValidVirtualAddressRange(addr, size)) {
376 SendReply(GDB_STUB_REPLY_ERR); 376 SendReply(GDB_STUB_REPLY_ERR);
377 return; 377 return;
378 } 378 }
@@ -383,7 +383,7 @@ void GDBStub::HandleBreakpointRemove(std::string_view command) {
383 case BreakpointType::Software: { 383 case BreakpointType::Software: {
384 const auto orig_insn{replaced_instructions.find(addr)}; 384 const auto orig_insn{replaced_instructions.find(addr)};
385 if (orig_insn != replaced_instructions.end()) { 385 if (orig_insn != replaced_instructions.end()) {
386 system.Memory().Write32(addr, orig_insn->second); 386 system.ApplicationMemory().Write32(addr, orig_insn->second);
387 system.InvalidateCpuInstructionCacheRange(addr, sizeof(u32)); 387 system.InvalidateCpuInstructionCacheRange(addr, sizeof(u32));
388 replaced_instructions.erase(addr); 388 replaced_instructions.erase(addr);
389 success = true; 389 success = true;
@@ -391,16 +391,16 @@ void GDBStub::HandleBreakpointRemove(std::string_view command) {
391 break; 391 break;
392 } 392 }
393 case BreakpointType::WriteWatch: 393 case BreakpointType::WriteWatch:
394 success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size, 394 success = system.ApplicationProcess()->RemoveWatchpoint(addr, size,
395 Kernel::DebugWatchpointType::Write); 395 Kernel::DebugWatchpointType::Write);
396 break; 396 break;
397 case BreakpointType::ReadWatch: 397 case BreakpointType::ReadWatch:
398 success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size, 398 success = system.ApplicationProcess()->RemoveWatchpoint(addr, size,
399 Kernel::DebugWatchpointType::Read); 399 Kernel::DebugWatchpointType::Read);
400 break; 400 break;
401 case BreakpointType::AccessWatch: 401 case BreakpointType::AccessWatch:
402 success = system.ApplicationProcess()->RemoveWatchpoint( 402 success = system.ApplicationProcess()->RemoveWatchpoint(
403 system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite); 403 addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
404 break; 404 break;
405 case BreakpointType::Hardware: 405 case BreakpointType::Hardware:
406 default: 406 default:
@@ -483,9 +483,9 @@ static std::optional<std::string> GetNameFromThreadType64(Core::Memory::Memory&
483static std::optional<std::string> GetThreadName(Core::System& system, 483static std::optional<std::string> GetThreadName(Core::System& system,
484 const Kernel::KThread* thread) { 484 const Kernel::KThread* thread) {
485 if (system.ApplicationProcess()->Is64BitProcess()) { 485 if (system.ApplicationProcess()->Is64BitProcess()) {
486 return GetNameFromThreadType64(system.Memory(), thread); 486 return GetNameFromThreadType64(system.ApplicationMemory(), thread);
487 } else { 487 } else {
488 return GetNameFromThreadType32(system.Memory(), thread); 488 return GetNameFromThreadType32(system.ApplicationMemory(), thread);
489 } 489 }
490} 490}
491 491