winedbg: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
13125b51cd
commit
0ea9fe999c
|
@ -2,7 +2,7 @@ MODULE = winedbg.exe
|
|||
IMPORTS = dbghelp advapi32
|
||||
DELAYIMPORTS = comdlg32 shell32 comctl32 user32 gdi32 ws2_32
|
||||
|
||||
EXTRADLLFLAGS = -mconsole -mcygwin
|
||||
EXTRADLLFLAGS = -mconsole
|
||||
|
||||
C_SRCS = \
|
||||
be_arm.c \
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "debugger.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include "shellapi.h"
|
||||
#include "psapi.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define MAX_PROGRAM_NAME_LENGTH 80
|
||||
|
@ -79,7 +77,7 @@ static WCHAR *get_program_name(HANDLE hProcess)
|
|||
return unidentified;
|
||||
}
|
||||
|
||||
programname = strrchrW(image_name, '\\');
|
||||
programname = wcsrchr(image_name, '\\');
|
||||
if (programname != NULL)
|
||||
programname++;
|
||||
else
|
||||
|
@ -89,7 +87,7 @@ static WCHAR *get_program_name(HANDLE hProcess)
|
|||
* user-friendly program name */
|
||||
|
||||
/* don't display a too long string to the user */
|
||||
if (strlenW(programname) >= MAX_PROGRAM_NAME_LENGTH)
|
||||
if (lstrlenW(programname) >= MAX_PROGRAM_NAME_LENGTH)
|
||||
{
|
||||
programname[MAX_PROGRAM_NAME_LENGTH - 4] = '.';
|
||||
programname[MAX_PROGRAM_NAME_LENGTH - 3] = '.';
|
||||
|
@ -382,7 +380,7 @@ int display_crash_dialog(void)
|
|||
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dbg_curr_pid);
|
||||
g_ProgramName = get_program_name(hProcess);
|
||||
CloseHandle(hProcess);
|
||||
if (!strcmpW( g_ProgramName, winedeviceW )) return TRUE;
|
||||
if (!wcscmp( g_ProgramName, winedeviceW )) return TRUE;
|
||||
InitCommonControlsEx( &init );
|
||||
return DialogBoxW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDD_CRASH_DLG), NULL, crash_dlg_proc);
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
#include "debugger.h"
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
static int (*db_printf)(const char* format, ...) __attribute__((format (printf,1,2)));
|
||||
static int WINAPIV (*db_printf)(const char* format, ...) __attribute__((format (printf,1,2)));
|
||||
#else
|
||||
static int (*db_printf)(const char* format, ...);
|
||||
static int WINAPIV (*db_printf)(const char* format, ...);
|
||||
#endif
|
||||
|
||||
static int no_printf(const char* format, ...) {return 0;}
|
||||
static int WINAPIV no_printf(const char* format, ...) {return 0;}
|
||||
|
||||
typedef DWORD_PTR db_addr_t;
|
||||
typedef BOOL boolean_t;
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
%option noinput nounput always-interactive 8bit prefix="dbg_"
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
|
|
@ -447,9 +447,9 @@ extern struct dbg_type types_find_type(DWORD64 linear, const char* name, enum S
|
|||
extern void dbg_outputW(const WCHAR* buffer, int len);
|
||||
extern const char* dbg_W2A(const WCHAR* buffer, unsigned len);
|
||||
#ifdef __GNUC__
|
||||
extern int dbg_printf(const char* format, ...) __attribute__((format (printf,1,2)));
|
||||
extern int WINAPIV dbg_printf(const char* format, ...) __attribute__((format (printf,1,2)));
|
||||
#else
|
||||
extern int dbg_printf(const char* format, ...);
|
||||
extern int WINAPIV dbg_printf(const char* format, ...);
|
||||
#endif
|
||||
extern const struct dbg_internal_var* dbg_get_internal_var(const char*);
|
||||
extern BOOL dbg_interrupt_debuggee(void);
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
|
|
@ -24,27 +24,20 @@
|
|||
* http://sources.redhat.com/gdb/onlinedocs/gdb/Maintenance-Commands.html
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "winsock2.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "debugger.h"
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winsock2.h"
|
||||
#include "tlhelp32.h"
|
||||
#include "wine/exception.h"
|
||||
#include "wine/debug.h"
|
||||
|
@ -1283,15 +1276,15 @@ static enum packet_return packet_read_register(struct gdb_context* gdbctx)
|
|||
if (!backend->get_context(thread->handle, &ctx))
|
||||
return packet_error;
|
||||
|
||||
if (sscanf(gdbctx->in_packet, "%zx", ®) != 1)
|
||||
if (sscanf(gdbctx->in_packet, "%Ix", ®) != 1)
|
||||
return packet_error;
|
||||
if (reg >= backend->gdb_num_regs)
|
||||
{
|
||||
WARN("Unhandled register %zu\n", reg);
|
||||
WARN("Unhandled register %Iu\n", reg);
|
||||
return packet_error;
|
||||
}
|
||||
|
||||
TRACE("%zu => %s\n", reg, wine_dbgstr_longlong(cpu_register(gdbctx, &ctx, reg)));
|
||||
TRACE("%Iu => %s\n", reg, wine_dbgstr_longlong(cpu_register(gdbctx, &ctx, reg)));
|
||||
|
||||
packet_reply_open(gdbctx);
|
||||
packet_reply_register_hex_to(gdbctx, &ctx, reg);
|
||||
|
@ -1318,18 +1311,18 @@ static enum packet_return packet_write_register(struct gdb_context* gdbctx)
|
|||
return packet_error;
|
||||
*ptr++ = '\0';
|
||||
|
||||
if (sscanf(gdbctx->in_packet, "%zx", ®) != 1)
|
||||
if (sscanf(gdbctx->in_packet, "%Ix", ®) != 1)
|
||||
return packet_error;
|
||||
if (reg >= backend->gdb_num_regs)
|
||||
{
|
||||
/* FIXME: if just the reg is above cpu_num_regs, don't tell gdb
|
||||
* it wouldn't matter too much, and it fakes our support for all regs
|
||||
*/
|
||||
WARN("Unhandled register %zu\n", reg);
|
||||
WARN("Unhandled register %Iu\n", reg);
|
||||
return packet_ok;
|
||||
}
|
||||
|
||||
TRACE("%zu <= %s\n", reg, debugstr_an(ptr, (int)(gdbctx->in_packet_len - (ptr - gdbctx->in_packet))));
|
||||
TRACE("%Iu <= %s\n", reg, debugstr_an(ptr, (int)(gdbctx->in_packet_len - (ptr - gdbctx->in_packet))));
|
||||
|
||||
cpu_register_hex_from(gdbctx, &ctx, reg, (const char**)&ptr);
|
||||
if (!backend->set_context(thread->handle, &ctx))
|
||||
|
@ -1747,7 +1740,7 @@ static void packet_query_target_xml(struct gdb_context* gdbctx, struct backend_c
|
|||
"</flags>");
|
||||
}
|
||||
|
||||
snprintf(buffer, ARRAY_SIZE(buffer), "<reg name=\"%s\" bitsize=\"%zu\"",
|
||||
snprintf(buffer, ARRAY_SIZE(buffer), "<reg name=\"%s\" bitsize=\"%Iu\"",
|
||||
cpu->gdb_register_map[i].name, 8 * cpu->gdb_register_map[i].length);
|
||||
packet_reply_add(gdbctx, buffer);
|
||||
|
||||
|
@ -2111,19 +2104,17 @@ static int fetch_data(struct gdb_context* gdbctx)
|
|||
|
||||
static BOOL gdb_exec(unsigned port, unsigned flags)
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
int fd;
|
||||
const char *gdb_path, *tmp_path;
|
||||
FILE* f;
|
||||
WCHAR tmp[MAX_PATH], buf[MAX_PATH];
|
||||
const char *argv[6];
|
||||
char *unix_tmp;
|
||||
const char *gdb_path;
|
||||
FILE* f;
|
||||
|
||||
if (!(gdb_path = getenv("WINE_GDB"))) gdb_path = "gdb";
|
||||
if (!(tmp_path = getenv("TMPDIR"))) tmp_path = "/tmp";
|
||||
strcpy(buf, tmp_path);
|
||||
strcat(buf, "/winegdb.XXXXXX");
|
||||
fd = mkstemps(buf, 0);
|
||||
if (fd == -1) return FALSE;
|
||||
if ((f = fdopen(fd, "w+")) == NULL) return FALSE;
|
||||
GetTempPathW( MAX_PATH, buf );
|
||||
GetTempFileNameW( buf, L"gdb", 0, tmp );
|
||||
if ((f = _wfopen( tmp, L"w+" )) == NULL) return FALSE;
|
||||
unix_tmp = wine_get_unix_file_name( tmp );
|
||||
fprintf(f, "target remote localhost:%d\n", ntohs(port));
|
||||
fprintf(f, "set prompt Wine-gdb>\\ \n");
|
||||
/* gdb 5.1 seems to require it, won't hurt anyway */
|
||||
|
@ -2137,18 +2128,19 @@ static BOOL gdb_exec(unsigned port, unsigned flags)
|
|||
*/
|
||||
fprintf(f, "set step-mode on\n");
|
||||
/* tell gdb to delete this file when done handling it... */
|
||||
fprintf(f, "shell rm -f \"%s\"\n", buf);
|
||||
fprintf(f, "shell rm -f \"%s\"\n", unix_tmp);
|
||||
fclose(f);
|
||||
argv[0] = "xterm";
|
||||
argv[1] = "-e";
|
||||
argv[2] = gdb_path;
|
||||
argv[3] = "-x";
|
||||
argv[4] = buf;
|
||||
argv[4] = unix_tmp;
|
||||
argv[5] = NULL;
|
||||
if (flags & FLAG_WITH_XTERM)
|
||||
__wine_unix_spawnvp( (char **)argv, FALSE );
|
||||
else
|
||||
__wine_unix_spawnvp( (char **)argv + 2, FALSE );
|
||||
HeapFree( GetProcessHeap(), 0, unix_tmp );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -177,7 +175,7 @@ static void module_print_info(const struct info_module *module, BOOL is_embedded
|
|||
is_embedded ? "\\" : get_symtype_str(&module->mi), module->name);
|
||||
}
|
||||
|
||||
static int module_compare(const void* p1, const void* p2)
|
||||
static int __cdecl module_compare(const void* p1, const void* p2)
|
||||
{
|
||||
struct info_module *left = (struct info_module *)p1;
|
||||
struct info_module *right = (struct info_module *)p2;
|
||||
|
|
|
@ -20,16 +20,12 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "debugger.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -31,7 +29,6 @@
|
|||
#include "winternl.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/exception.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
|
||||
|
||||
|
@ -308,11 +305,11 @@ void fetch_module_name(void* name_addr, void* mod_addr, WCHAR* buffer, size_t bu
|
|||
/* FIXME: proper NT->Dos conversion */
|
||||
static const WCHAR nt_prefixW[] = {'\\','?','?','\\'};
|
||||
|
||||
if (!strncmpW( buffer, nt_prefixW, 4 ))
|
||||
if (!wcsncmp( buffer, nt_prefixW, 4 ))
|
||||
memmove( buffer, buffer + 4, (lstrlenW(buffer + 4) + 1) * sizeof(WCHAR) );
|
||||
}
|
||||
else
|
||||
snprintfW(buffer, bufsz, dlladdr, (ULONG_PTR)mod_addr);
|
||||
swprintf(buffer, bufsz, dlladdr, (ULONG_PTR)mod_addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -376,7 +373,7 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
|
|||
if (!QueryFullProcessImageNameW( dbg_curr_process->handle, 0, u.buffer, &size ))
|
||||
{
|
||||
static const WCHAR pcspid[] = {'P','r','o','c','e','s','s','_','%','0','8','x',0};
|
||||
snprintfW( u.buffer, ARRAY_SIZE(u.buffer), pcspid, dbg_curr_pid);
|
||||
swprintf( u.buffer, ARRAY_SIZE(u.buffer), pcspid, dbg_curr_pid);
|
||||
}
|
||||
|
||||
WINE_TRACE("%04x:%04x: create process '%s'/%p @%p (%u<%u>)\n",
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
* upon which full support for datatype handling will eventually be built.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "debugger.h"
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -149,15 +146,15 @@ void dbg_outputW(const WCHAR* buffer, int len)
|
|||
/* FIXME: should CP_ACP be GetConsoleCP()? */
|
||||
}
|
||||
|
||||
int dbg_printf(const char* format, ...)
|
||||
int WINAPIV dbg_printf(const char* format, ...)
|
||||
{
|
||||
static char buf[4*1024];
|
||||
va_list valist;
|
||||
__ms_va_list valist;
|
||||
int len;
|
||||
|
||||
va_start(valist, format);
|
||||
__ms_va_start(valist, format);
|
||||
len = vsnprintf(buf, sizeof(buf), format, valist);
|
||||
va_end(valist);
|
||||
__ms_va_end(valist);
|
||||
|
||||
if (len <= -1 || len >= sizeof(buf))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue