public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Mark Kettenis <kettenis@chello.nl>
Cc: gdb@sources.redhat.com
Subject: Re: gdb support for Linux vsyscall DSO
Date: Tue, 13 May 2003 01:53:00 -0000	[thread overview]
Message-ID: <200305130153.h4D1rGW23237@magilla.sf.frob.com> (raw)
In-Reply-To: Mark Kettenis's message of  Monday, 12 May 2003 01:14:21 +0200 <200305112314.h4BNELkE002799@elgar.kettenis.dyndns.org>

> There is some special handling for signal trampolines in
> infrun.c:handle_inferior_event().  Beware!  Dragons can still be found
> in that function.  However, it seems the bit of code I'm talking about
> is there for targets that don't known how to properly unwind signal
> frames :-).

I only partly follow the code in that function, but it does look like it
wants to know whether it's in a signal frame.  I get the impression that
"next" or "step" interrupted by a signal lets the signal be handled and
continues until the end of the source line rather than doing a normal user
stop for the signal, and that this is considered desireable.  So it must know.

Having a DWARF2 extension to mark signal frames seems reasonable, and less
kludgey than matching symbol names.  However, I wonder if there is in fact
a way to do it that won't confuse older libgcc's .eh_frame unwinding code.

> Restoring %eflags is certainly possible.  Making GDB actually pop the
> signal trampoline frame should work

I only mentioned %eflags to pedantic because I caught myself about to say
"restore the exact state of the interrupted thread" and that wasn't
completely true.  I don't anticipate gdb having any reason to want to roll
back a signal frame.  (However, in the abstract it seems like the right
thing for the kernel unwind info to describe restoring %eflags if the
DWARF2 format can already represent that.)

> Well, for processes started by GDB we can read the auxiliary vector from
> the pristine stack, but that doesn't work for attached-to processes.

Good point.  I am inclined to think this is worth doing because, for the
case it covers, it is both fully robust and fully remote-friendly even with
old existing remote stubs, and is easy enough to implement on a per-target
basis.  If a direct inquiry is available, that will still be quicker than
the straightforward but numerous inferior memory reads that must be done to
extract the information from the stack, and so is the first choice; if it's
available for remote too, all the better.  But I think I will implement
this fallback at least for i386, just because it's a 100% correct solution
for at least half the cases (i.e. run but not attach) that can work today
without waiting for the a new kernel feature and/or remote stub upgrades to
be installed.

> Given that we know where the dynamic section is from l_ld, I think we
> can figure out all we need to know from there.

As a special case for the Linux vsyscall DSO, it would be adequate just to
presume it will fit in a single page and round down.  But you've reminded
me that there are other useful addresses to be found by looking in the
.dynamic section itself.  DT_HASH gives the location of the .hash section,
which a normal ld -shared always puts as the first section in the file,
appearing right after the file and program headers.  Without relying on
.hash being first per se, you can reasonably assume that the sections
referenced by DT_* are the first group in the file and so start with the
lowest of those addresses.  Rounding that address down to the smallest of
any actual ELF platform's page size (which might be 4k?) is a pretty darn
reasonable guess for finding the ELF header of any mapped DSO.


Thanks much for all the helpful feedback,
Roland

  reply	other threads:[~2003-05-13  1:53 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-09  9:45 gdb/dwarf-frame.c Roland McGrath
2003-05-09 13:41 ` gdb/dwarf-frame.c Daniel Jacobowitz
2003-05-09 14:10   ` gdb/dwarf-frame.c Elena Zannoni
2003-05-09 14:56     ` NPTL thread support H. J. Lu
2003-05-09 15:44       ` Elena Zannoni
     [not found]         ` <20030509091522.A2960@lucon.org>
     [not found]           ` <16059.55278.841645.134311@localhost.redhat.com>
2003-05-11 20:46             ` H. J. Lu
2003-05-12 19:24               ` J. Johnston
2003-05-12 20:08                 ` H. J. Lu
2003-05-12 20:15                   ` David Carlton
2003-05-12 21:09                     ` Andrew Cagney
2003-05-12 21:18                       ` David Carlton
2003-05-12 21:23                         ` Daniel Jacobowitz
2003-05-12 20:17                   ` Elena Zannoni
2003-05-09 17:01     ` gdb/dwarf-frame.c Andrew Cagney
2003-05-09 17:08       ` gdb/dwarf-frame.c Elena Zannoni
2003-05-09 19:43       ` gdb/dwarf-frame.c Mark Kettenis
2003-05-09 21:19         ` gdb/dwarf-frame.c Roland McGrath
2003-05-09 21:48           ` gdb/dwarf-frame.c Elena Zannoni
2003-05-09 22:17             ` gdb/dwarf-frame.c Roland McGrath
2003-05-09 21:54           ` gdb/dwarf-frame.c Andrew Cagney
2003-05-09 21:58           ` gdb/dwarf-frame.c Daniel Jacobowitz
2003-05-09 22:18             ` gdb/dwarf-frame.c Roland McGrath
2003-05-09 22:28         ` gdb/dwarf-frame.c Andrew Cagney
2003-05-09 22:33           ` gdb/dwarf-frame.c Roland McGrath
2003-05-09 20:32   ` gdb/dwarf-frame.c Roland McGrath
2003-05-09 19:36 ` gdb/dwarf-frame.c Mark Kettenis
2003-05-09 21:34   ` gdb/dwarf-frame.c Roland McGrath
2003-05-09 21:46     ` gdb/dwarf-frame.c Elena Zannoni
2003-05-10  7:07   ` gdb support for Linux vsyscall DSO Roland McGrath
2003-05-10 17:24     ` Andrew Cagney
2003-05-10 18:13       ` Daniel Jacobowitz
2003-05-10 19:42         ` Roland McGrath
2003-05-10 21:49           ` Andrew Cagney
2003-05-12 19:23             ` Andrew Cagney
2003-05-13  2:29               ` Roland McGrath
2003-05-13 16:03                 ` Andrew Cagney
2003-05-10 21:28       ` Roland McGrath
2003-05-10 17:55     ` Mark Kettenis
2003-05-10 20:27       ` Roland McGrath
2003-05-11 23:14         ` Mark Kettenis
2003-05-13  1:53           ` Roland McGrath [this message]
2003-05-15 21:26             ` Mark Kettenis
2003-05-16  2:25               ` Roland McGrath

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=200305130153.h4D1rGW23237@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=kettenis@chello.nl \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).