diff options
| author | 2020-10-20 19:07:39 -0700 | |
|---|---|---|
| committer | 2020-10-20 19:07:39 -0700 | |
| commit | 3d592972dc3fd61cc88771b889eff237e4e03e0f (patch) | |
| tree | 0dbc65ac86e609ae22087c7be9d4759ac6b73004 /src/core/gdbstub/gdbstub.cpp | |
| parent | kernel: Fix build with recent compiler flag changes (diff) | |
| download | yuzu-3d592972dc3fd61cc88771b889eff237e4e03e0f.tar.gz yuzu-3d592972dc3fd61cc88771b889eff237e4e03e0f.tar.xz yuzu-3d592972dc3fd61cc88771b889eff237e4e03e0f.zip | |
Revert "core: Fix clang build"
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
| -rw-r--r-- | src/core/gdbstub/gdbstub.cpp | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index 28a8a0f49..97ee65464 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp | |||
| @@ -205,7 +205,7 @@ static Kernel::Thread* FindThreadById(s64 id) { | |||
| 205 | const auto& threads = Core::System::GetInstance().GlobalScheduler().GetThreadList(); | 205 | const auto& threads = Core::System::GetInstance().GlobalScheduler().GetThreadList(); |
| 206 | for (auto& thread : threads) { | 206 | for (auto& thread : threads) { |
| 207 | if (thread->GetThreadID() == static_cast<u64>(id)) { | 207 | if (thread->GetThreadID() == static_cast<u64>(id)) { |
| 208 | current_core = static_cast<u32>(thread->GetProcessorID()); | 208 | current_core = thread->GetProcessorID(); |
| 209 | return thread.get(); | 209 | return thread.get(); |
| 210 | } | 210 | } |
| 211 | } | 211 | } |
| @@ -457,14 +457,7 @@ static u128 GdbHexToU128(const u8* src) { | |||
| 457 | /// Read a byte from the gdb client. | 457 | /// Read a byte from the gdb client. |
| 458 | static u8 ReadByte() { | 458 | static u8 ReadByte() { |
| 459 | u8 c; | 459 | u8 c; |
| 460 | 460 | std::size_t received_size = recv(gdbserver_socket, reinterpret_cast<char*>(&c), 1, MSG_WAITALL); | |
| 461 | #ifdef WIN32 | ||
| 462 | const auto socket_id = static_cast<SOCKET>(gdbserver_socket); | ||
| 463 | #else | ||
| 464 | const auto socket_id = gdbserver_socket; | ||
| 465 | #endif | ||
| 466 | |||
| 467 | const auto received_size = recv(socket_id, reinterpret_cast<char*>(&c), 1, MSG_WAITALL); | ||
| 468 | if (received_size != 1) { | 461 | if (received_size != 1) { |
| 469 | LOG_ERROR(Debug_GDBStub, "recv failed: {}", received_size); | 462 | LOG_ERROR(Debug_GDBStub, "recv failed: {}", received_size); |
| 470 | Shutdown(); | 463 | Shutdown(); |
| @@ -581,13 +574,7 @@ bool CheckBreakpoint(VAddr addr, BreakpointType type) { | |||
| 581 | * @param packet Packet to be sent to client. | 574 | * @param packet Packet to be sent to client. |
| 582 | */ | 575 | */ |
| 583 | static void SendPacket(const char packet) { | 576 | static void SendPacket(const char packet) { |
| 584 | #ifdef WIN32 | 577 | std::size_t sent_size = send(gdbserver_socket, &packet, 1, 0); |
| 585 | const auto socket_id = static_cast<SOCKET>(gdbserver_socket); | ||
| 586 | #else | ||
| 587 | const auto socket_id = gdbserver_socket; | ||
| 588 | #endif | ||
| 589 | |||
| 590 | const auto sent_size = send(socket_id, &packet, 1, 0); | ||
| 591 | if (sent_size != 1) { | 578 | if (sent_size != 1) { |
| 592 | LOG_ERROR(Debug_GDBStub, "send failed"); | 579 | LOG_ERROR(Debug_GDBStub, "send failed"); |
| 593 | } | 580 | } |
| @@ -624,13 +611,7 @@ static void SendReply(const char* reply) { | |||
| 624 | u8* ptr = command_buffer; | 611 | u8* ptr = command_buffer; |
| 625 | u32 left = command_length + 4; | 612 | u32 left = command_length + 4; |
| 626 | while (left > 0) { | 613 | while (left > 0) { |
| 627 | #ifdef WIN32 | 614 | const auto sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0); |
| 628 | const auto socket_id = static_cast<SOCKET>(gdbserver_socket); | ||
| 629 | #else | ||
| 630 | const auto socket_id = gdbserver_socket; | ||
| 631 | #endif | ||
| 632 | const auto sent_size = | ||
| 633 | send(socket_id, reinterpret_cast<char*>(ptr), static_cast<socklen_t>(left), 0); | ||
| 634 | if (sent_size < 0) { | 615 | if (sent_size < 0) { |
| 635 | LOG_ERROR(Debug_GDBStub, "gdb: send failed"); | 616 | LOG_ERROR(Debug_GDBStub, "gdb: send failed"); |
| 636 | return Shutdown(); | 617 | return Shutdown(); |
| @@ -1313,13 +1294,8 @@ static void Init(u16 port) { | |||
| 1313 | WSAStartup(MAKEWORD(2, 2), &InitData); | 1294 | WSAStartup(MAKEWORD(2, 2), &InitData); |
| 1314 | #endif | 1295 | #endif |
| 1315 | 1296 | ||
| 1316 | #ifdef WIN32 | 1297 | int tmpsock = static_cast<int>(socket(PF_INET, SOCK_STREAM, 0)); |
| 1317 | using socket_type = SOCKET; | 1298 | if (tmpsock == -1) { |
| 1318 | #else | ||
| 1319 | using socket_type = int; | ||
| 1320 | #endif | ||
| 1321 | const auto tmpsock = static_cast<socket_type>(socket(PF_INET, SOCK_STREAM, 0)); | ||
| 1322 | if (tmpsock == static_cast<socket_type>(-1)) { | ||
| 1323 | LOG_ERROR(Debug_GDBStub, "Failed to create gdb socket"); | 1299 | LOG_ERROR(Debug_GDBStub, "Failed to create gdb socket"); |
| 1324 | } | 1300 | } |
| 1325 | 1301 | ||
| @@ -1359,7 +1335,7 @@ static void Init(u16 port) { | |||
| 1359 | } | 1335 | } |
| 1360 | 1336 | ||
| 1361 | // Clean up temporary socket if it's still alive at this point. | 1337 | // Clean up temporary socket if it's still alive at this point. |
| 1362 | if (tmpsock != static_cast<socket_type>(-1)) { | 1338 | if (tmpsock != -1) { |
| 1363 | shutdown(tmpsock, SHUT_RDWR); | 1339 | shutdown(tmpsock, SHUT_RDWR); |
| 1364 | } | 1340 | } |
| 1365 | } | 1341 | } |
| @@ -1376,12 +1352,7 @@ void Shutdown() { | |||
| 1376 | 1352 | ||
| 1377 | LOG_INFO(Debug_GDBStub, "Stopping GDB ..."); | 1353 | LOG_INFO(Debug_GDBStub, "Stopping GDB ..."); |
| 1378 | if (gdbserver_socket != -1) { | 1354 | if (gdbserver_socket != -1) { |
| 1379 | #ifdef WIN32 | 1355 | shutdown(gdbserver_socket, SHUT_RDWR); |
| 1380 | const auto tmpsock = static_cast<SOCKET>(socket(PF_INET, SOCK_STREAM, 0)); | ||
| 1381 | #else | ||
| 1382 | const auto tmpsock = static_cast<int>(socket(PF_INET, SOCK_STREAM, 0)); | ||
| 1383 | #endif | ||
| 1384 | shutdown(tmpsock, SHUT_RDWR); | ||
| 1385 | gdbserver_socket = -1; | 1356 | gdbserver_socket = -1; |
| 1386 | } | 1357 | } |
| 1387 | 1358 | ||
| @@ -1412,7 +1383,7 @@ void SetCpuStepFlag(bool is_step) { | |||
| 1412 | step_loop = is_step; | 1383 | step_loop = is_step; |
| 1413 | } | 1384 | } |
| 1414 | 1385 | ||
| 1415 | void SendTrap(Kernel::Thread* thread, u32 trap) { | 1386 | void SendTrap(Kernel::Thread* thread, int trap) { |
| 1416 | if (!send_trap) { | 1387 | if (!send_trap) { |
| 1417 | return; | 1388 | return; |
| 1418 | } | 1389 | } |