Added support for qXfer:exec-file:read command in gdb proxy. This removes lots of garbage spitted by gdb.
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/gdbproxy.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index b8a8a1da2f8..04f1dabd312 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -1850,6 +1850,7 @@ static enum packet_return packet_query(struct gdb_context* gdbctx) packet_reply_add(gdbctx, "qXfer:libraries:read+;"); packet_reply_add(gdbctx, "qXfer:threads:read+;"); packet_reply_add(gdbctx, "qXfer:features:read+;"); + packet_reply_add(gdbctx, "qXfer:exec-file:read+;"); packet_reply_close(gdbctx); return packet_done; } @@ -1910,6 +1911,25 @@ static enum packet_return packet_query(struct gdb_context* gdbctx) packet_reply_close_xfer(gdbctx, off, len); return packet_done; } + + if (sscanf(gdbctx->in_packet, "Xfer:exec-file:read::%x,%x", &off, &len) == 2) + { + BOOL is_wow64; + char* unix_path; + char* tmp; + + if (!gdbctx->process || !gdbctx->process->imageName) return packet_error; + if (!(unix_path = wine_get_unix_file_name(gdbctx->process->imageName))) return packet_error; + + if (IsWow64Process(gdbctx->process->handle, &is_wow64) && + is_wow64 && (tmp = strstr(unix_path, "system32"))) + memcpy(tmp, "syswow64", 8); + packet_reply_open_xfer(gdbctx); + packet_reply_add(gdbctx, unix_path); + packet_reply_close_xfer(gdbctx, off, len); + HeapFree(GetProcessHeap(), 0, unix_path); + return packet_done; + } break; } ERR("Unhandled query %s\n", debugstr_an(gdbctx->in_packet, gdbctx->in_packet_len));