* windows-nat.c: Throughout, fix format strings and casts of

printf-like functions to avoid type related warnings on all
	platforms.
	(handle_output_debug_string): Fetch context information address
	from debug string using string_to_core_addr.
This commit is contained in:
Corinna Vinschen 2013-02-27 19:42:26 +00:00
parent 5b967901c5
commit d50a0ce273
2 changed files with 42 additions and 32 deletions

View file

@ -1,3 +1,11 @@
2013-02-27 Corinna Vinschen <vinschen@redhat.com>
* windows-nat.c: Throughout, fix format strings and casts of
printf-like functions to avoid type related warnings on all
platforms.
(handle_output_debug_string): Fetch context information address
from debug string using string_to_core_addr.
2013-02-27 Jiong Wang <jiwang@tilera.com> 2013-02-27 Jiong Wang <jiwang@tilera.com>
* regformats/reg-tilegx.dat (name): Change abi name to "tilegx". * regformats/reg-tilegx.dat (name): Change abi name to "tilegx".

View file

@ -289,8 +289,8 @@ static void
check (BOOL ok, const char *file, int line) check (BOOL ok, const char *file, int line)
{ {
if (!ok) if (!ok)
printf_filtered ("error return %s:%d was %lu\n", file, line, printf_filtered ("error return %s:%d was %u\n", file, line,
GetLastError ()); (unsigned) GetLastError ());
} }
/* Find a thread record given a thread id. If GET_CONTEXT is not 0, /* Find a thread record given a thread id. If GET_CONTEXT is not 0,
@ -311,8 +311,8 @@ thread_rec (DWORD id, int get_context)
if (SuspendThread (th->h) == (DWORD) -1) if (SuspendThread (th->h) == (DWORD) -1)
{ {
DWORD err = GetLastError (); DWORD err = GetLastError ();
warning (_("SuspendThread failed. (winerr %d)"), warning (_("SuspendThread failed. (winerr %u)"),
(int) err); (unsigned) err);
return NULL; return NULL;
} }
th->suspended = 1; th->suspended = 1;
@ -576,7 +576,8 @@ get_module_name (LPVOID base_address, char *dll_name_ret)
len = GetModuleFileNameEx (current_process_handle, len = GetModuleFileNameEx (current_process_handle,
DllHandle[i], pathbuf, __PMAX); DllHandle[i], pathbuf, __PMAX);
if (len == 0) if (len == 0)
error (_("Error getting dll name: %lu."), GetLastError ()); error (_("Error getting dll name: %u."),
(unsigned) GetLastError ());
if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, pathbuf, dll_name_ret, if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, pathbuf, dll_name_ret,
__PMAX) < 0) __PMAX) < 0)
error (_("Error converting dll name to POSIX: %d."), errno); error (_("Error converting dll name to POSIX: %d."), errno);
@ -977,7 +978,7 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
retval = strtoul (p, &p, 0); retval = strtoul (p, &p, 0);
if (!retval) if (!retval)
retval = main_thread_id; retval = main_thread_id;
else if ((x = (LPCVOID) strtoul (p, &p, 0)) else if ((x = (LPCVOID) string_to_core_addr (p))
&& ReadProcessMemory (current_process_handle, x, && ReadProcessMemory (current_process_handle, x,
&saved_context, &saved_context,
__COPY_CONTEXT_SIZE, &n) __COPY_CONTEXT_SIZE, &n)
@ -1000,7 +1001,7 @@ display_selector (HANDLE thread, DWORD sel)
if (GetThreadSelectorEntry (thread, sel, &info)) if (GetThreadSelectorEntry (thread, sel, &info))
{ {
int base, limit; int base, limit;
printf_filtered ("0x%03lx: ", sel); printf_filtered ("0x%03x: ", (unsigned) sel);
if (!info.HighWord.Bits.Pres) if (!info.HighWord.Bits.Pres)
{ {
puts_filtered ("Segment not present\n"); puts_filtered ("Segment not present\n");
@ -1064,7 +1065,7 @@ display_selector (HANDLE thread, DWORD sel)
if (err == ERROR_NOT_SUPPORTED) if (err == ERROR_NOT_SUPPORTED)
printf_filtered ("Function not supported\n"); printf_filtered ("Function not supported\n");
else else
printf_filtered ("Invalid selector 0x%lx.\n",sel); printf_filtered ("Invalid selector 0x%x.\n", (unsigned) sel);
return 0; return 0;
} }
} }
@ -1228,8 +1229,8 @@ handle_exception (struct target_waitstatus *ourstatus)
/* Treat unhandled first chance exceptions specially. */ /* Treat unhandled first chance exceptions specially. */
if (current_event.u.Exception.dwFirstChance) if (current_event.u.Exception.dwFirstChance)
return -1; return -1;
printf_unfiltered ("gdb: unknown target exception 0x%08lx at %s\n", printf_unfiltered ("gdb: unknown target exception 0x%08x at %s\n",
current_event.u.Exception.ExceptionRecord.ExceptionCode, (unsigned) current_event.u.Exception.ExceptionRecord.ExceptionCode,
host_address_to_string ( host_address_to_string (
current_event.u.Exception.ExceptionRecord.ExceptionAddress)); current_event.u.Exception.ExceptionRecord.ExceptionAddress));
ourstatus->value.sig = GDB_SIGNAL_UNKNOWN; ourstatus->value.sig = GDB_SIGNAL_UNKNOWN;
@ -1249,8 +1250,9 @@ windows_continue (DWORD continue_status, int id)
thread_info *th; thread_info *th;
BOOL res; BOOL res;
DEBUG_EVENTS (("ContinueDebugEvent (cpid=%ld, ctid=%lx, %s);\n", DEBUG_EVENTS (("ContinueDebugEvent (cpid=%d, ctid=%x, %s);\n",
current_event.dwProcessId, current_event.dwThreadId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
continue_status == DBG_CONTINUE ? continue_status == DBG_CONTINUE ?
"DBG_CONTINUE" : "DBG_EXCEPTION_NOT_HANDLED")); "DBG_CONTINUE" : "DBG_EXCEPTION_NOT_HANDLED"));
@ -1297,8 +1299,8 @@ fake_create_process (void)
open_process_used = 1; open_process_used = 1;
else else
{ {
error (_("OpenProcess call failed, GetLastError = %lud"), error (_("OpenProcess call failed, GetLastError = %u"),
GetLastError ()); (unsigned) GetLastError ());
/* We can not debug anything in that case. */ /* We can not debug anything in that case. */
} }
main_thread_id = current_event.dwThreadId; main_thread_id = current_event.dwThreadId;
@ -1457,7 +1459,7 @@ get_windows_debug_event (struct target_ops *ops,
switch (event_code) switch (event_code)
{ {
case CREATE_THREAD_DEBUG_EVENT: case CREATE_THREAD_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n", DEBUG_EVENTS (("gdb: kernel event for pid=%u tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId, (unsigned) current_event.dwThreadId,
"CREATE_THREAD_DEBUG_EVENT")); "CREATE_THREAD_DEBUG_EVENT"));
@ -1486,7 +1488,7 @@ get_windows_debug_event (struct target_ops *ops,
break; break;
case EXIT_THREAD_DEBUG_EVENT: case EXIT_THREAD_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n", DEBUG_EVENTS (("gdb: kernel event for pid=%u tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId, (unsigned) current_event.dwThreadId,
"EXIT_THREAD_DEBUG_EVENT")); "EXIT_THREAD_DEBUG_EVENT"));
@ -1500,7 +1502,7 @@ get_windows_debug_event (struct target_ops *ops,
break; break;
case CREATE_PROCESS_DEBUG_EVENT: case CREATE_PROCESS_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n", DEBUG_EVENTS (("gdb: kernel event for pid=%u tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId, (unsigned) current_event.dwThreadId,
"CREATE_PROCESS_DEBUG_EVENT")); "CREATE_PROCESS_DEBUG_EVENT"));
@ -1522,7 +1524,7 @@ get_windows_debug_event (struct target_ops *ops,
break; break;
case EXIT_PROCESS_DEBUG_EVENT: case EXIT_PROCESS_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n", DEBUG_EVENTS (("gdb: kernel event for pid=%u tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId, (unsigned) current_event.dwThreadId,
"EXIT_PROCESS_DEBUG_EVENT")); "EXIT_PROCESS_DEBUG_EVENT"));
@ -1542,7 +1544,7 @@ get_windows_debug_event (struct target_ops *ops,
break; break;
case LOAD_DLL_DEBUG_EVENT: case LOAD_DLL_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n", DEBUG_EVENTS (("gdb: kernel event for pid=%u tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId, (unsigned) current_event.dwThreadId,
"LOAD_DLL_DEBUG_EVENT")); "LOAD_DLL_DEBUG_EVENT"));
@ -1556,7 +1558,7 @@ get_windows_debug_event (struct target_ops *ops,
break; break;
case UNLOAD_DLL_DEBUG_EVENT: case UNLOAD_DLL_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n", DEBUG_EVENTS (("gdb: kernel event for pid=%u tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId, (unsigned) current_event.dwThreadId,
"UNLOAD_DLL_DEBUG_EVENT")); "UNLOAD_DLL_DEBUG_EVENT"));
@ -1569,7 +1571,7 @@ get_windows_debug_event (struct target_ops *ops,
break; break;
case EXCEPTION_DEBUG_EVENT: case EXCEPTION_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n", DEBUG_EVENTS (("gdb: kernel event for pid=%u tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId, (unsigned) current_event.dwThreadId,
"EXCEPTION_DEBUG_EVENT")); "EXCEPTION_DEBUG_EVENT"));
@ -1591,7 +1593,7 @@ get_windows_debug_event (struct target_ops *ops,
break; break;
case OUTPUT_DEBUG_STRING_EVENT: /* Message from the kernel. */ case OUTPUT_DEBUG_STRING_EVENT: /* Message from the kernel. */
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n", DEBUG_EVENTS (("gdb: kernel event for pid=%u tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId, (unsigned) current_event.dwThreadId,
"OUTPUT_DEBUG_STRING_EVENT")); "OUTPUT_DEBUG_STRING_EVENT"));
@ -1603,11 +1605,11 @@ get_windows_debug_event (struct target_ops *ops,
default: default:
if (saw_create != 1) if (saw_create != 1)
break; break;
printf_unfiltered ("gdb: kernel event for pid=%ld tid=%ld\n", printf_unfiltered ("gdb: kernel event for pid=%u tid=%x\n",
(DWORD) current_event.dwProcessId, (unsigned) current_event.dwProcessId,
(DWORD) current_event.dwThreadId); (unsigned) current_event.dwThreadId);
printf_unfiltered (" unknown event code %ld\n", printf_unfiltered (" unknown event code %u\n",
current_event.dwDebugEventCode); (unsigned) current_event.dwDebugEventCode);
break; break;
} }
@ -1865,8 +1867,8 @@ windows_detach (struct target_ops *ops, char *args, int from_tty)
if (!DebugActiveProcessStop (current_event.dwProcessId)) if (!DebugActiveProcessStop (current_event.dwProcessId))
{ {
error (_("Can't detach process %lu (error %lu)"), error (_("Can't detach process %u (error %u)"),
current_event.dwProcessId, GetLastError ()); (unsigned) current_event.dwProcessId, (unsigned) GetLastError ());
detached = 0; detached = 0;
} }
DebugSetProcessKillOnExit (FALSE); DebugSetProcessKillOnExit (FALSE);
@ -1876,8 +1878,8 @@ windows_detach (struct target_ops *ops, char *args, int from_tty)
char *exec_file = get_exec_file (0); char *exec_file = get_exec_file (0);
if (exec_file == 0) if (exec_file == 0)
exec_file = ""; exec_file = "";
printf_unfiltered ("Detaching from program: %s, Pid %lu\n", exec_file, printf_unfiltered ("Detaching from program: %s, Pid %u\n", exec_file,
current_event.dwProcessId); (unsigned) current_event.dwProcessId);
gdb_flush (gdb_stdout); gdb_flush (gdb_stdout);
} }
@ -2264,7 +2266,7 @@ windows_create_inferior (struct target_ops *ops, char *exec_file,
#endif #endif
if (!ret) if (!ret)
error (_("Error creating process %s, (error %d)."), error (_("Error creating process %s, (error %u)."),
exec_file, (unsigned) GetLastError ()); exec_file, (unsigned) GetLastError ());
CloseHandle (pi.hThread); CloseHandle (pi.hThread);