This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch v2 1/2] Enable ILP32 mode in gdb on aarch64


On Thu, 2017-03-09 at 13:24 +0000, Yao Qi wrote:
> 
> Assuming ILP32 kernel patches is correct, you can get these
> magic number by loading ILP32 kernel vmlinux, and doing these
> steps I do above.

The problem is that it looks like this isn't just a case of the offsets
changing, some of the kernel types have changed too and I think that is
the bigger problem.  The problem may be related to this GCC patch
involving exception handling:

	https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00581.html

This patch sets REG_VALUE_IN_UNWIND_CONTEXT, something that is only done
on one other platform, ILP32 mode on x86_64.  I tried looking at the ILP32
support for x86_64 in gdb but it doesn't seem to have any type of
sigframe_init routine.


In the unpatched kernel:

(gdb) ptype struct rt_sigframe
type = struct rt_sigframe {
    struct siginfo info;
    struct ucontext uc;
    u64 fp;
    u64 lr;
}

In the new kernel:

(gdb) ptype struct rt_sigframe
type = struct rt_sigframe {
    struct siginfo info;
    struct sigframe sig;
}

there is no ucontext.  There is one inside sigframe though:

(gdb) ptype struct sigframe
type = struct sigframe {
    struct ucontext uc;
    u64 fp;
    u64 lr;
}

But if I change the print to use the new structure I get the same offsets
with both kernels:

Old kernel:

(gdb) p/d  &((struct rt_sigframe *) 0)->uc
$2 = 128
(gdb) p/d  &((struct rt_sigframe *) 0)->uc->uc_mcontext
$1 = 304

New kernel:

(gdb) p/d &((struct rt_sigframe *) 0)->sig->uc
$2 = 128
(gdb) p/d &((struct rt_sigframe *) 0)->sig->uc->uc_mcontext
$1 = 304


Steve Ellcey
sellcey@cavium.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]