From: "Mark Kettenis" <mark.kettenis@xs4all.nl>
To: "Jan Kratochvil" <jan.kratochvil@redhat.com>
Cc: "Mark Kettenis" <mark.kettenis@xs4all.nl>,
gdb-patches@sourceware.org,
"Daniel Jacobowitz" <drow@false.org>,
"Jakub Jelinek" <jakub@redhat.com>
Subject: Re: [PATCH] Re: Unwinding CFI gcc practice of assumed `same value' regs
Date: Sun, 17 Dec 2006 13:06:00 -0000 [thread overview]
Message-ID: <5614.82.92.89.47.1166360768.squirrel@webmail.xs4all.nl> (raw)
In-Reply-To: <20061216234551.GA6766@host0.dyn.jankratochvil.net>
> On Wed, 13 Dec 2006 23:11:11 +0100, Jan Kratochvil wrote:
>
> On the other hand as a legacy compatibility I wrote the attached patch to
> fix the GDB excessive non-CFI amd64 `clone' unwind as 0x0. Other
> platforms(and functions?) could be carbon-copied from this one.
Do people indeed think the legacy support is worth the extra complication?
> I consider it the same approach as the way GDB currently on amd64 detects
> signal frames by checking the instructions - the CFI for signal frames
> has been also recently checked to the development glibc as was the
> `clone' CFI.
Hmm, now if the CFI on 'clone' is incorrect and doesn't mark the return
address as undefined, things will still fail. You're sure there are no
official glibc releases with bogus CFI for 'clone'?
> 2006-12-16 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * gdb/amd64-linux-tdep.c (linux_clone_code, LINUX_CLONE_LEN,
> amd64_linux_clone_running, amd64_linux_outermost_frame): Detect the
> caller of the thread `start_routing' as the outermost frame to unwind.
> (amd64_linux_init_abi): New hooking for `amd64_linux_outermost_frame'.
> * gdb/i386-tdep.h (gdbarch_tdep): New hook `outermost_frame_p'.
> * gdb/i386-tdep.c (i386_gdbarch_init): Likewise.
> * gdb/amd64-tdep.c (amd64_frame_this_id): Call `outermost_frame_p'.
>
> 2006-12-13 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * gdb.threads/bt-clone-stop.exp, gdb.threads/bt-clone-stop.c:
> Backtraced `clone' must not have `PC == 0' as its previous frame.
Hmm, I really have problems understanding your english Jan. Anyway, most
of it is irrelevant for ChangeLog. New functions, defines, etc. should
just be listed as New function, new define, etc. Only when you change
an existing function you need to describe what you changed (but not why,
since that should be a comment in your code). So instead of "New hooking
for 'amd64_linux_outermost_frame' I'd just write: initialize
outermost_frame_p.
> --- ./gdb/amd64-linux-tdep.c 19 Aug 2006 15:15:18 -0000 1.12
> +++ ./gdb/amd64-linux-tdep.c 16 Dec 2006 20:15:16 -0000
> @@ -235,6 +235,72 @@ amd64_linux_register_reggroup_p (struct
>
> /* Set the program counter for process PTID to PC. */
>
> +/* Detect the outermost frame as of:
> + #5 0x000000305cec68c3 in clone () from /lib64/tls/libc.so.6
> + We compare the `linux_clone_code' block to be _before_ the unwound PC.
> */
> +
> +static const unsigned char linux_clone_code[] =
> +{
> +/* libc/sysdeps/unix/sysv/linux/x86_64/clone.S */
> +/* #ifdef RESET_PID */
> +/* ... */
> +/* movl $SYS_ify(getpid), %eax */
> + 0x48, 0xc7, 0xc0, 0x27, 0x00, 0x00, 0x00,
> +/* syscall */
> + 0x0f, 0x05,
> +/* movl %eax, %fs:PID */
> + 0x64, 0x89, 0x04, 0x25, 0x94, 0x00, 0x00, 0x00,
> +/* movl %eax, %fs:TID */
> + 0x64, 0x89, 0x04, 0x25, 0x90, 0x00, 0x00, 0x00,
> +/* #endif */
> +/* |* Set up arguments for the function call. *| */
> +/* popq %rax |* Function to call. *| */
> + 0x58,
> +/* popq %rdi |* Argument. *| */
> + 0x5f,
> +/* call *%rax$ */
> + 0xff, 0xd0
> +};
The #ifdefs here make me a bit nervous
> + /* If we have NAME, we can optimize the search.
> + Check the code even in the case of the unambigious `__clone'
> + as before the `clone' syscall we still have a valid stack there.
> + FIXME: The whole part after the successful syscall there no longer
> has the
> + valid stack but we still try to unwind it, fortunately it applies
> only for
> + the case of tracing through `__clone'. */
Sorry, again I don't understand at all what you're saying here. Do you
mean that the parent thread may also be in clone() and in that case we
don't want to terminate the backtrace? But in that case I don't
understand why this is a FIXME.
> + /* Detect OS dependent outermost frames; such as `clone'. */
> + if (tdep->outermost_frame_p && tdep->outermost_frame_p (next_frame))
> + return;
> +
> +# #5 0x0000003421ecd62d in ?? () from /lib64/libc.so.6
> +# #6 0x0000000000000000 in ?? ()
> +# (gdb)
> +# Line `#6' must not be present
> +# Keep those two cases in this order!
> +# Fallback is some invalid output (FAIL).
> +gdb_test_multiple "bt" "0x0 entry output invalid" {
> + -re "in threader \\(.*\n#\[0-9\]* *0x0* in .*$gdb_prompt $" {
> + fail "0x0 entry found there"
> + }
> + -re "in threader \\(.*$gdb_prompt $" {
> + pass "0x0 entry not found there"
> + }
> +}
Sorry, again I don't understand your explanation here. Do you have a
collegue who is a native english speaker who can help you with writing
english?
Mark
next prev parent reply other threads:[~2006-12-17 13:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20061211190300.GA4372@host0.dyn.jankratochvil.net>
[not found] ` <20061211224022.AD76E1800E7@magilla.sf.frob.com>
[not found] ` <20061212155233.GH29911@devserv.devel.redhat.com>
2006-12-13 20:46 ` Jan Kratochvil
2006-12-13 21:04 ` Daniel Jacobowitz
2006-12-13 21:41 ` Mark Kettenis
2006-12-13 21:46 ` Daniel Jacobowitz
2006-12-13 21:53 ` Mark Kettenis
2006-12-13 22:11 ` Jan Kratochvil
2006-12-16 23:46 ` Jan Kratochvil
2006-12-17 13:06 ` Mark Kettenis [this message]
2006-12-17 18:23 ` Jan Kratochvil
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=5614.82.92.89.47.1166360768.squirrel@webmail.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=jakub@redhat.com \
--cc=jan.kratochvil@redhat.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