Nits
diff --git a/breakpoints.c b/breakpoints.c
index ab61bf2..8668e77 100644
--- a/breakpoints.c
+++ b/breakpoints.c
@@ -161,9 +161,6 @@
int
breakpoint_turn_on(struct breakpoint *bp, struct Process *proc)
{
- /* Make sure it was inserted. XXX In a clean world, we would
- * have breakpoint_site representing a place and breakpoint
- * representing inserted breakpoint. */
bp->enabled++;
if (bp->enabled == 1) {
assert(proc->pid != 0);
@@ -196,13 +193,7 @@
debug(DEBUG_FUNCTION, "insert_breakpoint(pid=%d, addr=%p, symbol=%s)",
proc->pid, addr, libsym ? libsym->name : "NULL");
- if (addr == 0) {
- /* XXX we need a better way to deal with this. For
- * now, just abuse errno to carry the error
- * information. */
- errno = EINVAL;
- return NULL;
- }
+ assert(addr != 0);
/* XXX what we need to do instead is have a list of
* breakpoints that are enabled at this address. The
diff --git a/handle_event.c b/handle_event.c
index bdda4d1..b0ac588 100644
--- a/handle_event.c
+++ b/handle_event.c
@@ -398,9 +398,11 @@
free(syscall);
return NULL;
}
+ /* XXX TODO: this needs to be fleshed out. */
library_init(syscalls, (enum library_type)-1);
library_set_soname(syscalls, "SYS", 0);
- library_symbol_init(syscall, 0, name, 0, LS_TOPLT_NONE);
+ if (library_symbol_init(syscall, 0, name, 0, LS_TOPLT_NONE) < 0)
+ abort();
library_add_symbol(syscalls, syscall);
return syscall;
}
diff --git a/ltrace-elf.c b/ltrace-elf.c
index 5628093..b01d34c 100644
--- a/ltrace-elf.c
+++ b/ltrace-elf.c
@@ -471,7 +471,7 @@
if (!filter_matches_symbol(options.plt_filter, name, lib))
continue;
- struct library_symbol *libsym;
+ struct library_symbol *libsym = NULL;
switch (arch_elf_add_plt_entry(proc, lte, name,
&rela, i, &libsym)) {
case plt_default:
diff --git a/proc.c b/proc.c
index 1634764..1d6ff6d 100644
--- a/proc.c
+++ b/proc.c
@@ -77,15 +77,13 @@
if (process_get_entry(proc, &entry, &interp_bias) < 0) {
fprintf(stderr, "Couldn't get entry points of process %d\n",
proc->pid);
- fail:
- process_bare_destroy(proc, 0);
return -1;
}
if (breakpoints_init(proc) < 0) {
fprintf(stderr, "failed to init breakpoints %d\n",
proc->pid);
- goto fail;
+ return -1;
}
return 0;
@@ -95,14 +93,18 @@
process_init(struct Process *proc, const char *filename, pid_t pid)
{
if (process_bare_init(proc, filename, pid, 0) < 0) {
+ fail:
error(0, errno, "init process %d", pid);
return -1;
}
- if (proc->leader == proc)
- return process_init_main(proc);
- else
+ if (proc->leader != proc)
return 0;
+ if (process_init_main(proc) < 0) {
+ process_bare_destroy(proc, 0);
+ goto fail;
+ }
+ return 0;
}
static void
diff --git a/sysdeps/linux-gnu/trace.h b/sysdeps/linux-gnu/trace.h
index 273a626..0116146 100644
--- a/sysdeps/linux-gnu/trace.h
+++ b/sysdeps/linux-gnu/trace.h
@@ -57,7 +57,7 @@
struct event_handler super;
/* The task that is doing the re-enablement. */
- Process *task_enabling_breakpoint;
+ struct Process *task_enabling_breakpoint;
/* The pointer being re-enabled. */
struct breakpoint *breakpoint_being_enabled;