This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] s/strerror/safe_strerror/
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 26 Mar 2002 21:54:56 -0500
- Subject: [patch] s/strerror/safe_strerror/
Hello,
The attached tweaks GDB to use safe_strerror() (almost) through out.
I'll check it in in a day or so.
Andrew
2002-03-23 Andrew Cagney <ac131313@redhat.com>
* valarith.c: Replace strerror with safe_strerror.
* tracepoint.c: Ditto.
* lin-lwp.c: Ditto.
* go32-nat.c: Ditto.
* inflow.c: Ditto.
* gnu-nat.c: Ditto.
Index: gnu-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-nat.c,v
retrieving revision 1.18
diff -u -r1.18 gnu-nat.c
--- gnu-nat.c 2002/01/06 19:18:28 1.18
+++ gnu-nat.c 2002/03/27 02:52:38
@@ -299,7 +299,7 @@
proc_debug (proc, "is %s", err ? "dead" : running ? "running" : "suspended");
if (err)
- proc_debug (proc, "err = %s", strerror (err));
+ proc_debug (proc, "err = %s", safe_strerror (err));
if (running)
{
@@ -468,7 +468,7 @@
proc->exc_port = exc_port;
else
warning ("Error setting exception port for %s: %s",
- proc_string (proc), strerror (err));
+ proc_string (proc), safe_strerror (err));
}
}
@@ -498,7 +498,7 @@
proc->exc_port = MACH_PORT_NULL;
else
warning ("Error setting exception port for %s: %s",
- proc_string (proc), strerror (err));
+ proc_string (proc), safe_strerror (err));
}
}
@@ -575,7 +575,7 @@
&prev_port);
if (err)
warning ("Couldn't request notification for port %d: %s",
- port, strerror (err));
+ port, safe_strerror (err));
else
{
proc_debug (proc, "notifications to: %d", inf->event_port);
@@ -724,7 +724,7 @@
err = mach_port_allocate (mach_task_self (),
MACH_PORT_RIGHT_RECEIVE, &inf->event_port);
if (err)
- error ("Error allocating event port: %s", strerror (err));
+ error ("Error allocating event port: %s", safe_strerror (err));
/* Make a send right for it, so we can easily copy it for other people. */
mach_port_insert_right (mach_task_self (), inf->event_port,
@@ -748,7 +748,7 @@
{
error_t err = proc_pid2task (proc_server, pid, &task_port);
if (err)
- error ("Error getting task for pid %d: %s", pid, strerror (err));
+ error ("Error getting task for pid %d: %s", pid, safe_strerror (err));
}
inf_debug (inf, "setting task: %d", task_port);
@@ -890,7 +890,7 @@
}
else if (err)
warning ("Can't modify tracing state for pid %d: %s",
- inf->pid, strerror (err));
+ inf->pid, safe_strerror (err));
else
inf->traced = on;
}
@@ -1366,7 +1366,7 @@
/* Can't do too much... */
warning ("Can't deliver signal %s: No signal thread.", NAME);
else if (err)
- warning ("Delivering signal %s: %s", NAME, strerror (err));
+ warning ("Delivering signal %s: %s", NAME, safe_strerror (err));
#undef NAME
}
@@ -1397,7 +1397,7 @@
}
if (err)
- warning ("Can't continue process: %s", strerror (err));
+ warning ("Can't continue process: %s", safe_strerror (err));
}
@@ -1460,7 +1460,7 @@
err =
proc_wait_request (proc_server, inf->event_port, inf->pid, WUNTRACED);
if (err)
- warning ("wait request failed: %s", strerror (err));
+ warning ("wait request failed: %s", safe_strerror (err));
else
{
inf_debug (inf, "waits pending: %d", proc_waits_pending);
@@ -1496,7 +1496,7 @@
if (err == EMACH_RCV_INTERRUPTED)
inf_debug (inf, "interrupted");
else if (err)
- error ("Couldn't wait for an event: %s", strerror (err));
+ error ("Couldn't wait for an event: %s", safe_strerror (err));
else
{
struct
@@ -1520,7 +1520,7 @@
if (reply.err)
error ("Handling event, msgid = %d: %s",
- msg.hdr.msgh_id, strerror (reply.err));
+ msg.hdr.msgh_id, safe_strerror (reply.err));
}
if (inf->pending_execs)
@@ -1796,7 +1796,7 @@
struct inf *inf = waiting_inf;
inf_debug (inf, "err = %s, pid = %d, status = 0x%x, sigcode = %d",
- err ? strerror (err) : "0", pid, status, sigcode);
+ err ? safe_strerror (err) : "0", pid, status, sigcode);
if (err && proc_wait_pid && (!inf->task || !inf->task->port))
/* Ack. The task has died, but the task-died notification code didn't
@@ -1817,7 +1817,7 @@
{
if (err != EINTR)
{
- warning ("Can't wait for pid %d: %s", inf->pid, strerror (err));
+ warning ("Can't wait for pid %d: %s", inf->pid, safe_strerror (err));
inf->no_wait = 1;
/* Since we can't see the inferior's signals, don't trap them. */
@@ -1873,7 +1873,7 @@
inf->wait.status.value.sig = TARGET_SIGNAL_0;
}
else if (err)
- warning ("Signal delivery failed: %s", strerror (err));
+ warning ("Signal delivery failed: %s", safe_strerror (err));
if (err)
/* We only get this reply when we've posted a signal to a process which we
@@ -2259,13 +2259,13 @@
err = hurd_safe_copyin (myaddr, (void *) addr - low_address + copied, length);
if (err)
{
- warning ("Read from inferior faulted: %s", strerror (err));
+ warning ("Read from inferior faulted: %s", safe_strerror (err));
length = 0;
}
err = vm_deallocate (mach_task_self (), copied, copy_count);
if (err)
- warning ("gnu_read_inferior vm_deallocate failed: %s", strerror (err));
+ warning ("gnu_read_inferior vm_deallocate failed: %s", safe_strerror (err));
return length;
}
@@ -2781,7 +2781,7 @@
&port, &port_type);
if (err)
error ("Couldn't extract send right %d from inferior: %s",
- name, strerror (err));
+ name, safe_strerror (err));
if (proc->saved_exc_port)
/* Get rid of our reference to the old one. */
@@ -2796,7 +2796,7 @@
proc->exc_port = proc->inf->event_port;
err = proc_set_exception_port (proc, proc->exc_port);
error ("Can't set exception port for %s: %s",
- proc_string (proc), strerror (err));
+ proc_string (proc), safe_strerror (err));
}
}
@@ -2970,7 +2970,7 @@
print_port_info (right, 0, inf->task->port, PORTINFO_DETAILS,
stdout);
if (err)
- error ("%ld: %s.", right, strerror (err));
+ error ("%ld: %s.", right, safe_strerror (err));
}
}
else
@@ -2980,7 +2980,7 @@
print_task_ports_info (inf->task->port, only, PORTINFO_DETAILS,
stdout);
if (err)
- error ("%s.", strerror (err));
+ error ("%s.", safe_strerror (err));
}
value_free_to_mark (vmark);
@@ -3241,7 +3241,7 @@
error_t err =
thread_info (thread->port, THREAD_BASIC_INFO, (int *) &info, &info_len);
if (err)
- error ("%s.", strerror (err));
+ error ("%s.", safe_strerror (err));
thread->sc = info->suspend_count;
if (from_tty)
printf_unfiltered ("Suspend count was %d.\n", thread->sc);
@@ -3352,6 +3352,6 @@
MATTR_CACHE,
&flush);
if (ret != KERN_SUCCESS)
- warning ("Error flushing inferior's cache : %s", strerror (ret));
+ warning ("Error flushing inferior's cache : %s", safe_strerror (ret));
}
#endif /* FLUSH_INFERIOR_CACHE */
Index: go32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/go32-nat.c,v
retrieving revision 1.30
diff -u -r1.30 go32-nat.c
--- go32-nat.c 2002/02/28 16:49:10 1.30
+++ go32-nat.c 2002/03/27 02:52:42
@@ -804,7 +804,7 @@
{
redir_to_debugger (&child_cmd);
error ("Cannot redirect standard handles for program: %s.",
- strerror (errno));
+ safe_strerror (errno));
}
/* set the console device of the inferior to whatever mode
(raw or cooked) we found it last time */
@@ -838,7 +838,7 @@
{
redir_to_child (&child_cmd);
error ("Cannot redirect standard handles for debugger: %s.",
- strerror (errno));
+ safe_strerror (errno));
}
}
}
Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.12
diff -u -r1.12 inflow.c
--- inflow.c 2001/07/23 19:21:51 1.12
+++ inflow.c 2002/03/27 02:52:43
@@ -171,7 +171,7 @@
#define OOPSY(what) \
if (result == -1) \
fprintf_unfiltered(gdb_stderr, "[%s failed in terminal_inferior: %s]\n", \
- what, strerror (errno))
+ what, safe_strerror (errno))
static void terminal_ours_1 (int);
@@ -374,7 +374,7 @@
such situations as well. */
if (result == -1)
fprintf_unfiltered (gdb_stderr, "[tcsetpgrp failed in terminal_ours: %s]\n",
- strerror (errno));
+ safe_strerror (errno));
#endif
#endif /* termios */
Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.32
diff -u -r1.32 lin-lwp.c
--- lin-lwp.c 2002/02/24 21:53:02 1.32
+++ lin-lwp.c 2002/03/27 02:52:47
@@ -376,7 +376,7 @@
if (ptrace (PTRACE_ATTACH, GET_LWP (ptid), 0, 0) < 0)
error ("Can't attach %s: %s", target_pid_to_str (ptid),
- strerror (errno));
+ safe_strerror (errno));
pid = waitpid (GET_LWP (ptid), &status, 0);
if (pid == -1 && errno == ECHILD)
@@ -454,7 +454,7 @@
if (ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
WSTOPSIG (lp->status)) < 0)
error ("Can't continue %s: %s", target_pid_to_str (lp->ptid),
- strerror (errno));
+ safe_strerror (errno));
lp->stopped = 0;
lp->signalled = 0;
@@ -471,7 +471,7 @@
if (ptrace (PTRACE_DETACH, GET_LWP (lp->ptid), 0,
WSTOPSIG (lp->status)) < 0)
error ("Can't detach %s: %s", target_pid_to_str (lp->ptid),
- strerror (errno));
+ safe_strerror (errno));
delete_lwp (lp->ptid);
}
@@ -973,7 +973,7 @@
if (pid == -1)
{
- warning ("Child process unexpectedly missing: %s", strerror (errno));
+ warning ("Child process unexpectedly missing: %s", safe_strerror (errno));
/* Claim it exited with unknown signal. */
ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.35
diff -u -r1.35 tracepoint.c
--- tracepoint.c 2002/03/23 17:38:13 1.35
+++ tracepoint.c 2002/03/27 02:53:09
@@ -2280,7 +2280,7 @@
pathname = tilde_expand (args);
if (!(fp = fopen (pathname, "w")))
error ("Unable to open file '%s' for saving tracepoints (%s)",
- args, strerror (errno));
+ args, safe_strerror (errno));
xfree (pathname);
ALL_TRACEPOINTS (tp)
Index: valarith.c
===================================================================
RCS file: /cvs/src/src/gdb/valarith.c,v
retrieving revision 1.13
diff -u -r1.13 valarith.c
--- valarith.c 2002/02/16 22:25:49 1.13
+++ valarith.c 2002/03/27 02:53:11
@@ -759,7 +759,7 @@
case BINOP_EXP:
v = pow (v1, v2);
if (errno)
- error ("Cannot perform exponentiation: %s", strerror (errno));
+ error ("Cannot perform exponentiation: %s", safe_strerror (errno));
break;
default:
@@ -897,7 +897,7 @@
case BINOP_EXP:
v = pow (v1, v2);
if (errno)
- error ("Cannot perform exponentiation: %s", strerror (errno));
+ error ("Cannot perform exponentiation: %s", safe_strerror (errno));
break;
case BINOP_REM:
@@ -1021,7 +1021,7 @@
case BINOP_EXP:
v = pow (v1, v2);
if (errno)
- error ("Cannot perform exponentiation: %s", strerror (errno));
+ error ("Cannot perform exponentiation: %s", safe_strerror (errno));
break;
case BINOP_REM: