On Mon, 28 Oct 2013 11:19:24 +0100, Mark Wielaard wrote:
I think with this the parts for libebl, backends and libdw/libwfl can
go
in.
OK. With tests on RHEL-6, on i386 and with -O2 I have found some other
issues [attached].
I'll look at the src and tests changes later. But those seem
separate
from the main part of this patch.
BTW there are also waiting the s390* and ppc* ports in the queue, not yet
posted, I have to rebase it a bit.
Thanks,
Jan
diff --git a/backends/i386_initreg.c b/backends/i386_initreg.c
index 7e5907e..9e819a4 100644
--- a/backends/i386_initreg.c
+++ b/backends/i386_initreg.c
@@ -40,9 +40,9 @@
#include "libebl_CPU.h"
bool
-i386_set_initial_registers_tid (pid_t tid,
- ebl_tid_registers_t *setfunc,
- void *arg)
+i386_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
+ ebl_tid_registers_t *setfunc __attribute__ ((unused)),
+ void *arg __attribute__ ((unused)))
{
#if !defined __i386__ && !defined __x86_64__
return false;
diff --git a/backends/x86_64_initreg.c b/backends/x86_64_initreg.c
index 754b320..0c49364 100644
--- a/backends/x86_64_initreg.c
+++ b/backends/x86_64_initreg.c
@@ -40,9 +40,9 @@
#include "libebl_CPU.h"
bool
-x86_64_set_initial_registers_tid (pid_t tid,
- ebl_tid_registers_t *setfunc,
- void *arg)
+x86_64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
+ ebl_tid_registers_t *setfunc __attribute__ ((unused)),
+ void *arg __attribute__ ((unused)))
{
#ifndef __x86_64__
return false;
diff --git a/libdwfl/frame_unwind.c b/libdwfl/frame_unwind.c
index 38137ba..1aed8cb 100644
--- a/libdwfl/frame_unwind.c
+++ b/libdwfl/frame_unwind.c
@@ -48,6 +48,7 @@
#endif
bool
+internal_function
__libdwfl_frame_reg_get (Dwfl_Frame *state, unsigned regno, Dwarf_Addr *val)
{
Ebl *ebl = state->thread->process->ebl;
@@ -62,6 +63,7 @@ __libdwfl_frame_reg_get (Dwfl_Frame *state, unsigned regno, Dwarf_Addr
*val)
}
bool
+internal_function
__libdwfl_frame_reg_set (Dwfl_Frame *state, unsigned regno, Dwarf_Addr val)
{
Ebl *ebl = state->thread->process->ebl;
diff --git a/libdwfl/dwfl_frame.c b/libdwfl/dwfl_frame.c
index af584fb..b785e2c 100644
--- a/libdwfl/dwfl_frame.c
+++ b/libdwfl/dwfl_frame.c
@@ -154,6 +154,7 @@ dwfl_attach_state (Dwfl *dwfl, int machine, pid_t pid,
}
else
{
+ ebl = NULL;
for (Dwfl_Module *mod = dwfl->modulelist; mod != NULL; mod = mod->next)
{
Dwfl_Error error = __libdwfl_module_getebl (mod);
@@ -326,13 +326,14 @@ dwfl_thread_getframes (Dwfl_Thread *thread,
Dwfl_Error err = dwfl_errno ();
if (process->callbacks->thread_detach)
process->callbacks->thread_detach (thread, thread->callbacks_arg);
- thread_free_all_states (thread);
if (state == NULL || state->pc_state == DWFL_FRAME_STATE_ERROR)
{
+ thread_free_all_states (thread);
__libdwfl_seterrno (err);
return -1;
}
assert (state->pc_state == DWFL_FRAME_STATE_PC_UNDEFINED);
+ thread_free_all_states (thread);
return 0;
}
INTDEF(dwfl_thread_getframes)
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 8dd7177..ba2fb0f 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -208,7 +208,8 @@ thread_callback (Dwfl_Thread *thread, void *thread_arg)
return 1;
case -1:
error (0, 0, "dwfl_thread_getframes: %s", dwfl_errmsg (-1));
- return 1;
+ /* All platforms do not have yet proper unwind termination. */
+ break;
default:
abort ();
}