mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Memory: Remove all GetPointer usages from the GDB stub.
This commit is contained in:
		
							parent
							
								
									30fabc41c6
								
							
						
					
					
						commit
						7772fc0731
					
				
					 1 changed files with 12 additions and 8 deletions
				
			
		|  | @ -644,7 +644,7 @@ static void ReadMemory() { | ||||||
| 
 | 
 | ||||||
|     auto start_offset = command_buffer + 1; |     auto start_offset = command_buffer + 1; | ||||||
|     auto addr_pos = std::find(start_offset, command_buffer + command_length, ','); |     auto addr_pos = std::find(start_offset, command_buffer + command_length, ','); | ||||||
|     PAddr addr = HexToInt(start_offset, static_cast<u32>(addr_pos - start_offset)); |     VAddr addr = HexToInt(start_offset, static_cast<u32>(addr_pos - start_offset)); | ||||||
| 
 | 
 | ||||||
|     start_offset = addr_pos + 1; |     start_offset = addr_pos + 1; | ||||||
|     u32 len = |     u32 len = | ||||||
|  | @ -656,12 +656,14 @@ static void ReadMemory() { | ||||||
|         SendReply("E01"); |         SendReply("E01"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const u8* data = Memory::GetPointer(addr); |     if (!Memory::IsValidVirtualAddress(addr)) { | ||||||
|     if (!data) { |  | ||||||
|         return SendReply("E00"); |         return SendReply("E00"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     MemToGdbHex(reply, data, len); |     std::vector<u8> data(len); | ||||||
|  |     Memory::ReadBlock(addr, data.data(), len); | ||||||
|  | 
 | ||||||
|  |     MemToGdbHex(reply, data.data(), len); | ||||||
|     reply[len * 2] = '\0'; |     reply[len * 2] = '\0'; | ||||||
|     SendReply(reinterpret_cast<char*>(reply)); |     SendReply(reinterpret_cast<char*>(reply)); | ||||||
| } | } | ||||||
|  | @ -670,18 +672,20 @@ static void ReadMemory() { | ||||||
| static void WriteMemory() { | static void WriteMemory() { | ||||||
|     auto start_offset = command_buffer + 1; |     auto start_offset = command_buffer + 1; | ||||||
|     auto addr_pos = std::find(start_offset, command_buffer + command_length, ','); |     auto addr_pos = std::find(start_offset, command_buffer + command_length, ','); | ||||||
|     PAddr addr = HexToInt(start_offset, static_cast<u32>(addr_pos - start_offset)); |     VAddr addr = HexToInt(start_offset, static_cast<u32>(addr_pos - start_offset)); | ||||||
| 
 | 
 | ||||||
|     start_offset = addr_pos + 1; |     start_offset = addr_pos + 1; | ||||||
|     auto len_pos = std::find(start_offset, command_buffer + command_length, ':'); |     auto len_pos = std::find(start_offset, command_buffer + command_length, ':'); | ||||||
|     u32 len = HexToInt(start_offset, static_cast<u32>(len_pos - start_offset)); |     u32 len = HexToInt(start_offset, static_cast<u32>(len_pos - start_offset)); | ||||||
| 
 | 
 | ||||||
|     u8* dst = Memory::GetPointer(addr); |     if (!Memory::IsValidVirtualAddress(addr)) { | ||||||
|     if (!dst) { |  | ||||||
|         return SendReply("E00"); |         return SendReply("E00"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     GdbHexToMem(dst, len_pos + 1, len); |     std::vector<u8> data(len); | ||||||
|  | 
 | ||||||
|  |     GdbHexToMem(data.data(), len_pos + 1, len); | ||||||
|  |     Memory::WriteBlock(addr, data.data(), len); | ||||||
|     SendReply("OK"); |     SendReply("OK"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue