From: Eli Zaretskii <eliz@gnu.org>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org, pedro@codesourcery.com, uweigand@de.ibm.com
Subject: Re: RFC: Longjmp vs LD_POINTER_GUARD revisited
Date: Sun, 15 Nov 2009 18:06:00 -0000 [thread overview]
Message-ID: <83pr7jmzos.fsf@gnu.org> (raw)
In-Reply-To: <20091115173429.GB23483@caradoc.them.org>
> Date: Sun, 15 Nov 2009 12:34:29 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: Pedro Alves <pedro@codesourcery.com>, Ulrich Weigand <uweigand@de.ibm.com>
>
> This patch updates Pedro's work to current trunk, and adds a pragmatic
> hack. If we recognize the name of the current function as definitely
> related to longjmp, then we know it won't return normally, so we
> should continue stepping. For x86_64 glibc, the magic name is
> "__longjmp". Otherwise, we do a frame check as before.
Thanks.
> + /* The functions we set a longjmp breakpoint on. */
> + if (strcmp (func, "longjmp") == 0)
> + return 1;
> + if (strcmp (func, "_longjmp") == 0)
> + return 1;
> + if (strcmp (func, "siglongjmp") == 0)
> + return 1;
> + if (strcmp (func, "_longjmp") == 0)
> + return 1;
Did you really mean to have _longjmp twice here?
> Index: src/gdb/NEWS
> ===================================================================
> --- src.orig/gdb/NEWS 2009-11-15 11:12:57.000000000 -0500
> +++ src/gdb/NEWS 2009-11-15 11:17:33.000000000 -0500
> @@ -3,6 +3,10 @@
>
> *** Changes since GDB 7.0
>
> +* Support for stepping and nexting over longjmp has been improved. It now
> +works independently of the architecture and supports recent versions
> +of GLIBC.
> +
> * New targets
This part is fine.
> Index: src/gdb/doc/gdbint.texinfo
> ===================================================================
> --- src.orig/gdb/doc/gdbint.texinfo 2009-11-15 11:17:50.000000000 -0500
> +++ src/gdb/doc/gdbint.texinfo 2009-11-15 11:25:35.000000000 -0500
> @@ -609,15 +609,20 @@ stepping. This is done with a few speci
> which are visible in the output of the @samp{maint info breakpoint}
> command.
>
> -@findex gdbarch_get_longjmp_target
> -To make this work, you need to define a function called
> -@code{gdbarch_get_longjmp_target}, which will examine the
> -@code{jmp_buf} structure and extract the @code{longjmp} target address.
> -Since @code{jmp_buf} is target specific and typically defined in a
> -target header not available to @value{GDBN}, you will need to
> -determine the offset of the PC manually and return that; many targets
> -define a @code{jb_pc_offset} field in the tdep structure to save the
> -value once calculated.
> +When @value{GDBN} detects a call to @code{longjmp}, it begins
> +stepping the program. As long as the program is still inside
> +the call to @code{longjmp} (as determined by either the current
> +function name or a stack frame search), @value{GDBN} continues
> +stepping. Once the program has left @code{longjmp}, @value{GDBN}
> +determines whether to stop or to resume an earlier @code{next}
> +opertion.
> +
> +In many cases you do not need any architecture-specific support
> +for this feature. You may need to augment @code{still_in_longjmp_frame_p}
> +in @file{infrun.c} to recognize any functions called by @code{longjmp}
> +which make unusual changes to the stack. It can recognize
> +functions by name, and could recognize additional cases
> +by instruction scanning to support a stripped C library.
This is also OK, but I'd suggest to add an index entry for
still_in_longjmp_frame_p.
Thanks.
next prev parent reply other threads:[~2009-11-15 18:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-15 17:35 Daniel Jacobowitz
2009-11-15 18:06 ` Eli Zaretskii [this message]
2009-11-15 18:30 ` Paul Pluzhnikov
2009-11-15 22:36 ` Daniel Jacobowitz
2009-11-15 23:06 ` Paul Pluzhnikov
2009-11-16 14:37 ` Daniel Jacobowitz
2009-11-16 14:55 ` Pedro Alves
2009-11-16 14:56 ` Pedro Alves
2009-11-16 15:05 ` Pedro Alves
2009-11-16 17:50 ` Daniel Jacobowitz
2009-11-15 18:39 ` Joseph S. Myers
2009-11-15 21:52 ` Mark Kettenis
2009-11-15 22:37 ` Daniel Jacobowitz
2009-11-16 15:15 ` Frank Ch. Eigler
2009-11-16 15:40 ` Paul Pluzhnikov
2009-11-16 15:43 ` Paul Pluzhnikov
2009-11-16 16:19 ` Mark Kettenis
2009-11-16 15:59 ` Mark Kettenis
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=83pr7jmzos.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
--cc=uweigand@de.ibm.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