From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10446 invoked by alias); 19 Nov 2012 14:43:15 -0000 Received: (qmail 10322 invoked by uid 22791); 19 Nov 2012 14:43:13 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-qa0-f41.google.com (HELO mail-qa0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Nov 2012 14:42:32 +0000 Received: by mail-qa0-f41.google.com with SMTP id c26so31543qad.0 for ; Mon, 19 Nov 2012 06:42:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.201.73 with SMTP id ez9mr11723770qab.92.1353336152134; Mon, 19 Nov 2012 06:42:32 -0800 (PST) Received: by 10.49.12.116 with HTTP; Mon, 19 Nov 2012 06:42:32 -0800 (PST) In-Reply-To: <10412685.433941353312405484.JavaMail.weblogic@epml02> References: <10412685.433941353312405484.JavaMail.weblogic@epml02> Date: Mon, 19 Nov 2012 14:43:00 -0000 Message-ID: Subject: Re: [PATCH] Fix for incorect breakpoint set in case of clang compiled binary From: "H.J. Lu" To: kv.bhat@samsung.com Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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 X-SW-Source: 2012-11/txt/msg00495.txt.bz2 On Mon, Nov 19, 2012 at 12:06 AM, KARTHIKVENKATESH BHAT wrote: > Dear All, > I wanted to add a patch in i386-tdep.c . Similar to what is done in other architectures such as ARM, > instead of actually going through the complete prologue if we can use the symbol table information to resolve prologue end. > > > Index: gdb/i386-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/i386-tdep.c,v > retrieving revision 1.362 > diff -u -p -r1.362 i386-tdep.c > --- gdb/i386-tdep.c 12 Nov 2012 21:59:06 -0000 1.362 > +++ gdb/i386-tdep.c 19 Nov 2012 07:56:45 -0000 > @@ -1582,8 +1582,30 @@ i386_skip_prologue (struct gdbarch *gdba > CORE_ADDR pc; > gdb_byte op; > int i; > + cache.locals = -1; > + CORE_ADDR func_addr; > + struct symtab *s = find_pc_symtab (func_addr); > + > + if (find_pc_partial_function (start_pc, NULL, &func_addr, NULL)) > + { > + CORE_ADDR post_prologue_pc > + = skip_prologue_using_sal (gdbarch, func_addr); > + > + /* GCC always emits a line note before the prologue and another > + one after, even if the two are at the same address or on the > + same line. Take advantage of this so that we do not need to > + know every instruction that might appear in the prologue. We > + will have producer information for most binaries; if it is > + missing (e.g. for -gstabs), assuming the GNU tools. */ > + if (post_prologue_pc > + && (s == NULL > + || s->producer == NULL > + || strncmp (s->producer, "GNU ", sizeof ("GNU ") - 1) == 0 > + || strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0)) > + return max (start_pc, post_prologue_pc); > + } > + > > It doesn't look like target-dependent. If we do this, why not make it a target-independent function make all targets call it? -- H.J.