34 char buf[4096] = { 0 };
47 char *promptFound = strstr(
buf,
"Wine-dbg>");
59 if (!
fd || !
fd->data) {
65 int words =
count / wordSize;
66 for (
i = 0;
i < words;
i++) {
73 int left =
count % wordSize;
76 memcpy(&leftW,
w + words, left);
86 if (!
fd || !
fd->data) {
89 if (
count > (1024 * 128)) {
95 Wine-
dbg>
x/128
b 0x7b444730
96 0x7b444730 _start_process+0x10a: cc 83 ec 08 57 56 e8 b5 fe ff ff 83
c4 04 50 e8
97 0x7b444740 _start_process+0x11a: 24 2
f 01 00 83
c4 0
c 8
b 44 24 68 83 ec 08 ff 70
98 0x7b444750 _start_process+0x12a: 5
c 6
a fe e8 27 2
f 01 00 83
c4 08 e8 34 de 01 00
99 0x7b444760 _debugstr_w: 55 89 e5 83 ec 08 83 ec 08 6
a ff 51 e8 45 e0 01
100 0x7b444770 _debugstr_w+0x10: 00 83
c4 18 5
d c3 55 89 e5 53 57 56 83 e4
f0 81
101 0x7b444780 ___wine_kernel_init+0xa: ec e0 0
e 00 00 e8 00 00 00 00 5
e 64 a1 18 00 00
102 0x7b444790 ___wine_kernel_init+0x1a: 00 89 44 24 40 8
b 40 30 89 44 24 44 8
b 78 10 8
b
103 0x7b4447a0 ___wine_kernel_init+0x2a: 86 ca 48 1
b 00 83 ec 08 31 db 53 ff 30 e8 e4 de
110 int words =
count / wordSize;
111 for (
i = 0;
i < words;
i++) {
116 sscanf(res,
"%x", &
w[
i]);
122 int left =
count % wordSize;
129 sscanf(res,
"%x", &
n);
132 memcpy(
buf + (words * wordSize), wn, left);
138 if (!
fd || !
fd->data) {
162 return (!strncmp(
pathname,
"winedbg://", 10));
181 eprintf(
"Wine-dbg is ready to go!\n");
184 eprintf(
"Can't find the Wine-dbg prompt\n");
195 static struct winedbg_x86_32
regState(void) {
196 struct winedbg_x86_32
r = { 0 };
197 char *res =
runcmd(
"info reg");
199 char *
line = strstr(res,
"EIP:");
201 ut32 eip, esp, ebp, eflags;
202 (void)sscanf(
line,
"EIP:%08x ESP:%08x EBP:%08x EFLAGS:%08x",
203 &eip, &esp, &ebp, &eflags);
211 (void)sscanf(
line,
"EAX:%08x EBX:%08x ECX:%08x EDX:%08x",
220 (void)sscanf(
line,
"ESI:%08x EDI:%08x", &
esi, &
edi);
232 if (!strcmp(
cmd,
"")) {
235 if (!strncmp(
cmd,
"?", 1)) {
236 eprintf(
"dr : show registers\n");
237 eprintf(
"dr* : show registers as flags\n");
238 eprintf(
"drp : show reg profile\n");
239 eprintf(
"dr8 : show hexpairs with regstate\n");
241 eprintf(
"dp : show process info\n");
244 eprintf(
"pid : show current process id\n");
245 }
else if (!strncmp(
cmd,
"dr8", 3)) {
247 struct winedbg_x86_32 *arena =
RZ_NEWS0(
struct winedbg_x86_32, 3);
250 return (
char *)arena;
252 }
else if (!strncmp(
cmd,
"drp", 3)) {
275 "gpr eflags .32 24 0\n"
284 "flg flags .16 24 0\n"
296 "flg vm .1 .203 0\n";
298 }
else if (!strncmp(
cmd,
"dr*", 3)) {
309 io->
cb_printf(
"f eflags @ 0x%08x\n",
r.eflags);
316 }
else if (!strncmp(
cmd,
"dr", 2)) {
318 }
else if (!strncmp(
cmd,
"db ", 3)) {
320 }
else if (!strncmp(
cmd,
"ds", 2)) {
322 }
else if (!strncmp(
cmd,
"dc", 2)) {
324 }
else if (!strncmp(
cmd,
"dso", 3)) {
326 }
else if (!strncmp(
cmd,
"dp", 3)) {
328 }
else if (!strncmp(
cmd,
"dm", 3)) {
329 char *wineDbgMaps =
runcmd(
"info maps");
333 char *ptr = wineDbgMaps;
335 char *nl = strchr(ptr,
'\n');
342 if (strstr(ptr,
" commit ")) {
343 if (strstr(ptr,
"RW")) {
358 }
else if (!strncmp(
cmd,
"pid", 3)) {
368 .desc =
"Wine-dbg io and debug.io plugin",
369 .uris =
"winedbg://",
381 #ifndef RZ_PLUGIN_INCORE
lsl lsr asr ror lsl lsr asr ror lsl lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror c3
lsl lsr asr ror lsl lsr asr ror lsl lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror c4
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
RZ_API char * sdb_fmt(const char *fmt,...)
RZ_API void Ht_() free(HtName_(Ht) *ht)
static void printcmd(RzIO *io, const char *cmd)
static int __read(RzIO *io, RzIODesc *fd, ut8 *buf, int count)
static char * runcmd(const char *cmd)
static bool __plugin_open(RzIO *io, const char *pathname, bool many)
static RzIODesc * __open(RzIO *io, const char *pathname, int rw, int mode)
RZ_API RzLibStruct rizin_plugin
RZ_PACKED(struct winedbg_x86_32 { ut16 cs;ut16 ss;ut16 ds;ut16 es;ut16 fs;ut16 gs;ut32 eip;ut32 esp;ut32 ebp;ut32 eflags;ut32 eax;ut32 ebx;ut32 ecx;ut32 edx;ut32 esi;ut32 edi;})
static int __write(RzIO *io, RzIODesc *fd, const ut8 *buf, int count)
static ut64 __lseek(RzIO *io, RzIODesc *fd, ut64 offset, int whence)
static int __close(RzIODesc *fd)
RzIOPlugin rz_io_plugin_winedbg
static char * __system(RzIO *io, RzIODesc *fd, const char *cmd)
static struct winedbg_x86_32 regState(void)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char pathname
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API int rz_hex_bin2str(const ut8 *in, int len, char *out)
RZ_API RzIODesc * rz_io_desc_new(RzIO *io, RzIOPlugin *plugin, const char *uri, int flags, int mode, void *data)
RZ_API ut64 rz_num_get(RzNum *num, const char *str)
RZ_API bool rz_socket_spawn(RzSocket *s, const char *cmd, unsigned int timeout)
RZ_API bool rz_socket_block_time(RzSocket *s, bool block, int sec, int usec)
RZ_API void RZ_API int rz_socket_read(RzSocket *s, ut8 *read, int len)
RZ_API void rz_socket_printf(RzSocket *s, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API RzSocket * rz_socket_new(bool is_ssl)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_str_append(char *ptr, const char *string)
RZ_API int rz_sys_cmdf(const char *fmt,...) RZ_PRINTF_CHECK(1
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
static struct sockaddr static addrlen static backlog const void msg
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const z80_opcode fd[]