On Sat, Feb 11, 2012 at 08:00:34PM +0530, Rabin Vincent wrote:
> Unwinding doesn't work on recent ARM kernels since after the following
> commit the kernel doesn't perform the prel31_to_addr() conversion of the
> offsets in the index table. The leads to crash not finding the correct
> unwind instructions.
>
>
http://git.kernel.org/linus/de66a979012dbc66b1ec0125795a3f79ee667b8a
>
> The patch below makes crash do the conversion itself if necessary.
>
> Rabin
>
> diff --git a/unwind_arm.c b/unwind_arm.c
> index d86ec63..e804cfb 100644
> --- a/unwind_arm.c
> +++ b/unwind_arm.c
> @@ -71,6 +71,8 @@ struct unwind_table {
> static struct unwind_table *kernel_unwind_table;
> static struct unwind_table *module_unwind_tables;
>
> +static int index_in_prel31;
> +
> struct unwind_ctrl_block {
> ulong vrs[16];
> ulong insn;
> @@ -104,6 +106,7 @@ static int is_core_kernel_text(ulong);
> static struct unwind_table *search_table(ulong);
> static struct unwind_idx *search_index(const struct unwind_table
> *, ulong);
> static ulong prel31_to_addr(ulong, ulong);
> +static void index_prel31_to_addr(struct unwind_table *);
> static int unwind_frame(struct stackframe *, ulong);
>
> /*
> @@ -187,6 +190,8 @@ init_kernel_unwind_table(void)
> goto fail;
> }
>
> + index_in_prel31 =
> !is_kernel_text(kernel_unwind_table->idx[0].addr);
Maybe add some comment explaining why we do this check (a reference to the
kernel commit perhaps)?
I agree about the comment -- and then some...
This seems to be a fairly signficant piece of information to be hidden
in a static variable:
+static int index_in_prel31;
Can you put it in the ARM machine_specific data structure? And then
display it in arm_dump_machdep_table() for "help -m".
Thanks,
Dave