From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24261 invoked by alias); 21 May 2014 15:28:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 24250 invoked by uid 89); 21 May 2014 15:28:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 May 2014 15:28:51 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4LFSkSN006223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 May 2014 11:28:47 -0400 Received: from barimba (ovpn-113-182.phx2.redhat.com [10.3.113.182]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4LFSjxX002210 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Wed, 21 May 2014 11:28:45 -0400 From: Tom Tromey To: Don Breazeal Cc: , Don Breazeal Subject: Re: [PATCH 2/4][REPOST] Remote Linux ptrace exec events References: <1398885482-8449-1-git-send-email-donb@codesourcery.com> <1398885482-8449-3-git-send-email-donb@codesourcery.com> Date: Wed, 21 May 2014 15:28:00 -0000 In-Reply-To: <1398885482-8449-3-git-send-email-donb@codesourcery.com> (Don Breazeal's message of "Wed, 30 Apr 2014 12:18:00 -0700") Message-ID: <87ha4jnob7.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-05/txt/msg00489.txt.bz2 >>>>> "Don" == Don Breazeal writes: Don> One caveat: when an exec is detected, gdbserver emits a couple of warnings: Don> gdbserver: unexpected r_debug version 0 Don> gdbserver: unexpected r_debug version 0 Don> However, debugging of shared libraries that are loaded by the exec'd Don> program works just fine. These messages may be caused by gdbserver making Don> an attempt to initialize the solib hook before the r_debug structure has Don> been initialized. I intend to follow up in a subsequent patch. I think it would be better to have that fix in the initial patch. I am curious what others think though. Don> diff --git a/gdb/common/linux-ptrace.c b/gdb/common/linux-ptrace.c Don> index e3fc705..b137df9 100644 Don> --- a/gdb/common/linux-ptrace.c Don> +++ b/gdb/common/linux-ptrace.c Don> @@ -491,8 +491,11 @@ linux_test_for_tracefork (int child_pid) Don> if (ret == child_pid && WIFSTOPPED (status) Don> && status >> 16 == PTRACE_EVENT_EXIT) Don> { Don> - /* PTRACE_O_TRACEEXIT is supported. */ Don> - current_ptrace_options |= PTRACE_O_TRACEEXIT; Don> + /* PTRACE_O_TRACEEXIT is supported. We use exit events to Don> + implement support for exec events. Since fork events are Don> + supported we know exec events are supported, so we enable Don> + exec events here. */ Don> + current_ptrace_options |= PTRACE_O_TRACEEXIT | PTRACE_O_TRACEEXEC; Don> } There's code earlier in the function that is #ifdef GDBSERVER and that checks PTRACE_O_TRACEEXEC for gdb. It seems like more unification there would be a better approach. Don> +static int Don> +extended_event_reported (const struct target_waitstatus *waitstatus) Don> +{ Don> + Don> + if (waitstatus == NULL) Don> + return 0; Don> + Don> + return waitstatus->kind == TARGET_WAITKIND_EXECD; Extra newline after the "{". I can't really comment on the rest, I'm afraid. Tom