@@ -496,6 +496,17 @@ GDBRemoteCommunicationServerCommon::Handle_qSpeedTest(
496
496
return SendErrorResponse (7 );
497
497
}
498
498
499
+ static GDBErrno system_errno_to_gdb (int err) {
500
+ switch (err) {
501
+ #define HANDLE_ERRNO (name, value ) \
502
+ case name: \
503
+ return GDB_##name;
504
+ #include " Plugins/Process/gdb-remote/GDBRemoteErrno.def"
505
+ default :
506
+ return GDB_EUNKNOWN;
507
+ }
508
+ }
509
+
499
510
GDBRemoteCommunication::PacketResult
500
511
GDBRemoteCommunicationServerCommon::Handle_vFile_Open (
501
512
StringExtractorGDBRemote &packet) {
@@ -522,9 +533,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Open(
522
533
} else {
523
534
response.PutCString (" -1" );
524
535
std::error_code code = errorToErrorCode (file.takeError ());
525
- if (code.category () == std::system_category ()) {
526
- response.Printf (" ,%x" , code.value ());
527
- }
536
+ response.Printf (" ,%x" , system_errno_to_gdb (code.value ()));
528
537
}
529
538
530
539
return SendPacketNoLock (response.GetString ());
@@ -534,17 +543,6 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Open(
534
543
return SendErrorResponse (18 );
535
544
}
536
545
537
- static GDBErrno system_errno_to_gdb (int err) {
538
- switch (err) {
539
- #define HANDLE_ERRNO (name, value ) \
540
- case name: \
541
- return GDB_##name;
542
- #include " Plugins/Process/gdb-remote/GDBRemoteErrno.def"
543
- default :
544
- return GDB_EUNKNOWN;
545
- }
546
- }
547
-
548
546
GDBRemoteCommunication::PacketResult
549
547
GDBRemoteCommunicationServerCommon::Handle_vFile_Close (
550
548
StringExtractorGDBRemote &packet) {
0 commit comments