Replace some uses of error with fprintf
error is not standard so it has no business being used in generic code.
The linux-gnu back end is useful for android, and that doesn't have that
interface either.
diff --git a/proc.c b/proc.c
index 627e93c..51833fe 100644
--- a/proc.c
+++ b/proc.c
@@ -11,7 +11,6 @@
#include <errno.h>
#include <stdlib.h>
#include <assert.h>
-#include <error.h>
#include "common.h"
#include "breakpoint.h"
@@ -126,7 +125,8 @@
{
if (process_bare_init(proc, filename, pid, 0) < 0) {
fail:
- error(0, errno, "init process %d", pid);
+ fprintf(stderr, "failed to initialize process %d: %s\n",
+ pid, strerror(errno));
return -1;
}
@@ -245,7 +245,8 @@
{
if (process_bare_init(retp, proc->filename, pid, 0) < 0) {
fail:
- error(0, errno, "clone process %d->%d", proc->pid, pid);
+ fprintf(stderr, "failed to clone process %d->%d : %s\n",
+ proc->pid, pid, strerror(errno));
return -1;
}
@@ -644,7 +645,8 @@
struct library_symbol *libsym = NULL;
while ((libsym = library_each_symbol(lib, libsym, breakpoint_for_symbol,
proc)) != NULL)
- error(0, errno, "insert breakpoint for %s", libsym->name);
+ fprintf(stderr, "couldn't insert breakpoint for %s to %d: %s",
+ libsym->name, proc->pid, strerror(errno));
}
int
@@ -709,8 +711,9 @@
assert(dict_find_entry(proc->breakpoints, bp->addr) == NULL);
if (dict_enter(proc->breakpoints, bp->addr, bp) < 0) {
- error(0, errno, "couldn't enter breakpoint %s@%p to dictionary",
- breakpoint_name(bp), bp->addr);
+ fprintf(stderr,
+ "couldn't enter breakpoint %s@%p to dictionary: %s\n",
+ breakpoint_name(bp), bp->addr, strerror(errno));
return -1;
}