From: Steve Ellcey <sellcey@caviumnetworks.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [Patch v2 1/2] Enable ILP32 mode in gdb on aarch64
Date: Thu, 09 Mar 2017 17:33:00 -0000 [thread overview]
Message-ID: <1489080786.22552.23.camel@caviumnetworks.com> (raw)
In-Reply-To: <CAH=s-PM6+sjn5MN=qV-z64s0pv1=K=5dX2DR-X4vSgkwgHr+xQ@mail.gmail.com>
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
prev parent reply other threads:[~2017-03-09 17:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-06 22:03 Steve Ellcey
2017-03-07 10:20 ` Yao Qi
2017-03-07 19:55 ` Steve Ellcey
2017-03-09 13:24 ` Yao Qi
2017-03-09 17:33 ` Steve Ellcey [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489080786.22552.23.camel@caviumnetworks.com \
--to=sellcey@caviumnetworks.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox