Jinoh Kang : winedbg: Implement GDB qXfer object exec-file.
Alexandre Julliard
julliard at winehq.org
Tue Nov 23 16:03:31 CST 2021
Module: wine
Branch: master
Commit: ebc60f64e126378db114dbd195f5801ce4909fa7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ebc60f64e126378db114dbd195f5801ce4909fa7
Author: Jinoh Kang <jinoh.kang.kr at gmail.com>
Date: Wed Nov 24 00:11:15 2021 +0900
winedbg: Implement GDB qXfer object exec-file.
Today, when gdbproxy is started with --no-start mode, GDB fails to
recognise the symbol file unless the `file` command or the
`sharedlibrary` command is explicitly issued.
Also, RHEL's downstream GDB complains with the following message:
Remote gdbserver does not support determining executable automatically.
RHEL <=6.8 and <=7.2 versions of gdbserver do not support such automatic executable detection.
The following versions of gdbserver support it:
- Upstream version of gdbserver (unsupported) 7.10 or later
- Red Hat Developer Toolset (DTS) version of gdbserver from DTS 4.0 or later (only on x86_64)
- RHEL-7.3 versions of gdbserver (on any architecture)
Fix this by implementing the qXfer object "exec-file".
Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/winedbg/gdbproxy.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index c21fed43b48..37d7c8ffc66 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -98,7 +98,10 @@ struct gdb_context
/* assume standard signal and errno values */
enum host_error
{
+ HOST_EPERM = 1,
+ HOST_ENOENT = 2,
HOST_ESRCH = 3,
+ HOST_ENOMEM = 12,
HOST_EFAULT = 14,
HOST_EINVAL = 22,
};
@@ -1928,6 +1931,33 @@ static enum packet_return packet_query_features(struct gdb_context* gdbctx)
return packet_reply_error(gdbctx, 0);
}
+static enum packet_return packet_query_exec_file(struct gdb_context* gdbctx)
+{
+ struct reply_buffer* reply = &gdbctx->qxfer_buffer;
+ struct dbg_process* process = gdbctx->process;
+ char *unix_path;
+ BOOL is_wow64;
+ char *tmp;
+
+ if (!process) return packet_error;
+
+ if (gdbctx->qxfer_object_annex[0] || !process->imageName)
+ return packet_reply_error(gdbctx, HOST_EPERM);
+
+ if (!(unix_path = wine_get_unix_file_name(process->imageName)))
+ return packet_reply_error(gdbctx, GetLastError() == ERROR_NOT_ENOUGH_MEMORY ? HOST_ENOMEM : HOST_ENOENT);
+
+ if (IsWow64Process(process->handle, &is_wow64) &&
+ is_wow64 && (tmp = strstr(unix_path, "system32")))
+ memcpy(tmp, "syswow64", 8);
+
+ reply_buffer_append_str(reply, unix_path);
+
+ HeapFree(GetProcessHeap(), 0, unix_path);
+
+ return packet_send_buffer;
+}
+
struct qxfer
{
const char* name;
@@ -1937,6 +1967,7 @@ struct qxfer
{"libraries", packet_query_libraries},
{"threads" , packet_query_threads },
{"features" , packet_query_features },
+ {"exec-file", packet_query_exec_file},
};
static enum packet_return packet_query(struct gdb_context* gdbctx)
More information about the wine-cvs
mailing list