From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10690 invoked by alias); 10 Nov 2014 15:45:50 -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 10678 invoked by uid 89); 10 Nov 2014 15:45:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 10 Nov 2014 15:45:47 +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 sAAFjg88021187 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Nov 2014 10:45:42 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAAFjeAZ025697; Mon, 10 Nov 2014 10:45:41 -0500 Message-ID: <5460DDA4.1010107@redhat.com> Date: Mon, 10 Nov 2014 15:45:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: Ulrich Weigand , Doug Evans CC: gdb-patches@sourceware.org Subject: Re: [PATCH] create_internal_breakpoint: Apply gdbarch_skip_entrypoint. References: <201411101258.sAACwh1O008384@d03av02.boulder.ibm.com> In-Reply-To: <201411101258.sAACwh1O008384@d03av02.boulder.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-11/txt/msg00168.txt.bz2 On 11/10/2014 12:58 PM, Ulrich Weigand wrote: > Doug Evans worte: > >> This is important because the toolchain will optimize intra-module calls >> to skip the first two instructions that set up the TOC register. >> And since gdb currently doesn't to "entry point skipping" for internal >> breakpoints things work (in particular shlib event breakpoints). > > Huh. Yes, that's clearly a bug. > >> This patch fixes things by applying entry point skipping to >> internal breakpoints. Is this the best place to apply entry point >> skipping for internal breakpoints? > > I think this is fine. (The alternative would be push it up into the > callers, which would have the advantage that you could do it only > for those callers that get the address from a symbol, and not those > that e.g. get it from a probe. However, since gdbarch_skip_entrypoint > is safe even if the address is not equal to a symbol address, it's > probably preferable to just do the skipping in one place.) Hmm, not sure. Are there cases that do want a breakpoint on the specific address that was passed down, even if it was the entry point address? I'm looking at the watchpoint scope code: scope_breakpoint = create_internal_breakpoint (frame_unwind_caller_arch (frame), frame_unwind_caller_pc (frame), bp_watchpoint_scope, &momentary_breakpoint_ops); and wondering about a signal coming in just while the mainline code was going to execute the entry point address. Should we add a create_internal_breakpoint_at_function method, and adjust callers that are setting a breakpoint at a function, rather than a specific address (like probes and the scope watchpoint), to use that instead [1]? (or the opposite; add a new create_internal_breakpoint_at_address function?) I'm particularly thinking of gdbarch_convert_from_func_ptr_addr, and wondering why create_overlay_event_breakpoint doesn't need to call it. The jit event breakpoint code doesn't call it either, it seems. And neither the longjmp even breakpoint, when the breakpoint it set by function name instead of by probe. Are these just cases of people not having stumbled on this yet? Or are these event locations/functions different somehow? Why does the solib-svr4.c need to call gdbarch_convert_from_func_ptr_addr for its event functions, while others do not? [1] something like: static struct breakpoint * create_internal_breakpoint_at_function (struct gdbarch *gdbarch, CORE_ADDR address, enum bptype type, const struct breakpoint_ops *ops) { address = gdbarch_convert_from_func_ptr_addr (..., address, ...); address = gdbarch_skip_entrypoint (..., address, ...); return create_internal_breakpoint (..., address, ...) } (or instead move the gdbarch calls to a helper function that given an address, returns the function's breakpoint address?) Thanks, Pedro Alves