public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: elfutils-devel@lists.fedorahosted.org
Subject: Re: [PATCH] Add --core-pattern option to eu-stack
Date: Thu, 27 Nov 2014 22:47:33 +0100	[thread overview]
Message-ID: <20141127214733.GA30049@host2.jankratochvil.net> (raw)
In-Reply-To: 1417087059.4954.43.camel@bordewijk.wildebeest.org

[-- Attachment #1: Type: text/plain, Size: 1497 bytes --]

On Thu, 27 Nov 2014 12:17:39 +0100, Mark Wielaard wrote:
> On Wed, 2014-11-26 at 15:44 +0100, Jan Kratochvil wrote:
> > I was trying to figure out some more generic functionality than --core-pattern
> > but given that for core_pattern one needs to:
> > 	PTRACE_SEIZE
> > 	close(0)
> > 	waitpid()
> > I do not find any part of this sequence separable, do you?
> 
> The close (0) is somewhat odd. I assume it signals the process is done
> with handling the core file data and waitpid () never returns without
> that?

Yes.


> But it does seem somewhat harmless. Are there any bad side effects from
> closing stdin? We don't handle stdin at the moment. Although we could
> maybe add --core=- to be explicit about the core data coming from stdin.

I have discussed reading core file for --core-pattern in my other mail.


> The waitpid () really is just waiting for PTRACE_EVENT_EXIT. So if you
> wrap that in a while loop wouldn't it just work fine too in case the
> user uses it with -p <tid> on a thread that they want to get the
> backtrace of when it exits instead of in a core file pattern handler
> pipe?

Which way?
#1
	PTRACE_SEIZE
	waitpid()
	 = lock-up on waitpid()
#2
	close(0); (in a process exec-ing eu-readelf)
	PTRACE_SEIZE
	 = ESRCH; not tested but I find it obvious, the process has disappeared
	waitpid()
	 = ECHILD; not tested but obviously there is no ptraced process

I do not see where a while loop could be applied.


Thanks,
Jan

             reply	other threads:[~2014-11-27 21:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27 21:47 Jan Kratochvil [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-11-28 15:04 Mark Wielaard
2014-11-28 14:44 Mark Wielaard
2014-11-28 14:27 Mark Wielaard
2014-11-27 21:41 Jan Kratochvil
2014-11-27 21:27 Jan Kratochvil
2014-11-27 11:17 Mark Wielaard
2014-11-27 11:05 Mark Wielaard
2014-11-27 11:04 Mark Wielaard
2014-11-26 20:57 Oleg Nesterov
2014-11-26 20:26 Jan Kratochvil
2014-11-26 20:08 Oleg Nesterov
2014-11-26 14:47 Jan Kratochvil
2014-11-26 14:44 Jan Kratochvil
2014-11-26 14:32 Jan Kratochvil
2014-11-03 13:22 Mark Wielaard
2014-10-30 21:55 Mark Wielaard

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=20141127214733.GA30049@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=elfutils-devel@lists.fedorahosted.org \
    /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).