Undefined uintptr_t with mingw

Alberto Luaces
2010-12-21T16:35:17Z

Hello,

while building gdb with the mingw cross-compiler from Debian
(4.4.4-0.1+b1) I run across this error:

i586-mingw32msvc-gcc -c -Wall -g -O2 -D__USE_MINGW_ACCESS -I. -I../../../gdb-7.2/gdb/gdbserver -I../../../gdb-7.2/gdb/gdbserver/../common -I../../../gdb-7.2/gdb/gdbserver/../regformats -I../../../gdb-7.2/gdb/gdbserver/../../include ../../../gdb-7.2/gdb/gdbserver/win32-low.c
../../../gdb-7.2/gdb/gdbserver/win32-low.c: In function ‘child_add_thread’:
../../../gdb-7.2/gdb/gdbserver/win32-low.c:192: error: ‘uintptr_t’ undeclared (first use in this function)
../../../gdb-7.2/gdb/gdbserver/win32-low.c:192: error: (Each undeclared identifier is reported only once
../../../gdb-7.2/gdb/gdbserver/win32-low.c:192: error: for each function it appears in.)
../../../gdb-7.2/gdb/gdbserver/win32-low.c:192: error: expected ‘;’ before ‘tlb’
../../../gdb-7.2/gdb/gdbserver/win32-low.c: In function ‘child_xfer_memory’:
../../../gdb-7.2/gdb/gdbserver/win32-low.c:283: error: ‘uintptr_t’ undeclared (first use in this function)
../../../gdb-7.2/gdb/gdbserver/win32-low.c:283: error: expected ‘;’ before ‘addr’
../../../gdb-7.2/gdb/gdbserver/win32-low.c:287: error: ‘addr’ undeclared (first use in this function)
../../../gdb-7.2/gdb/gdbserver/win32-low.c: In function ‘handle_load_dll’:
../../../gdb-7.2/gdb/gdbserver/win32-low.c:1208: error: ‘uintptr_t’ undeclared (first use in this function)
../../../gdb-7.2/gdb/gdbserver/win32-low.c:1208: error: expected ‘;’ before ‘event’
../../../gdb-7.2/gdb/gdbserver/win32-low.c: In function ‘handle_unload_dll’:
../../../gdb-7.2/gdb/gdbserver/win32-low.c:1216: error: ‘uintptr_t’ undeclared (first use in this function)
../../../gdb-7.2/gdb/gdbserver/win32-low.c:1216: error: expected ‘,’ or ‘;’ before ‘current_event’
../../../gdb-7.2/gdb/gdbserver/win32-low.c: In function ‘handle_exception’:
../../../gdb-7.2/gdb/gdbserver/win32-low.c:1317: error: ‘uintptr_t’ undeclared (first use in this function)
../../../gdb-7.2/gdb/gdbserver/win32-low.c:1317: error: expected ‘)’ before ‘current_event’
../../../gdb-7.2/gdb/gdbserver/win32-low.c:1317: error: too few arguments to function ‘phex_nz’
make[4]: *** [win32-low.o] Error 1

Since uintptr_t is defined in <stdint.h>, I succesfully built gdb with
this change:

diff -ur gdb-7.2orig/gdb/gdbserver/win32-low.c gdb-7.2/gdb/gdbserver/win32-low.c
--- gdb-7.2orig/gdb/gdbserver/win32-low.c 2010-12-21 16:27:10.000000000 +0100
+++ gdb-7.2/gdb/gdbserver/win32-low.c 2010-12-21 17:21:56.000000000 +0100
@@ -33,6 +33,7 @@
#include <sys/param.h>
#include <malloc.h>
#include <process.h>
+#include <stdint.h>

#ifndef USE_WIN32API
#include <sys/cygwin.h>

Does it sound right to apply to GDB?

Thanks,

--
Alberto