Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: KARTHIKVENKATESH BHAT <kv.bhat@samsung.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: Re: [PATCH] Fix for incorect breakpoint set in case of clang compiled binary
Date: Mon, 19 Nov 2012 15:19:00 -0000	[thread overview]
Message-ID: <12507387.452971353338357020.JavaMail.weblogic@epml02> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=windows-1252, Size: 2648 bytes --]

Hi, 
Yes the below code (uses symbol table to determine the end of prologue) may not be target dependent in this case.
But the same method in ARM for e.g.(arm-tdep.c /arm_skip_prologue) uses some target specific call  such as -
(post_prologue_pc)
post_prologue_pc  = arm_skip_stack_protector (post_prologue_pc, gdbarch);

so moving the function to a target-independent function may not be that useful. Hence added the same in i386-tdep.c.

Regards
Karthik

------- Original Message -------
Sender : H.J. Lu<hjl.tools@gmail.com>
Date : Nov 19, 2012 23:42 (GMT+09:00)
Title : Re: [PATCH] Fix for incorect breakpoint set in case of clang compiled binary

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.\x16º&Öéj×!zÊÞ¶êç÷­:âX¬µªÜ†\a[¥«\…ë

             reply	other threads:[~2012-11-19 15:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 15:19 KARTHIKVENKATESH BHAT [this message]
2012-11-20  4:58 KARTHIKVENKATESH BHAT
2012-11-21 15:39 KARTHIKVENKATESH BHAT
2012-11-27 13:47 KARTHIKVENKATESH BHAT
2012-11-28  5:14 KARTHIKVENKATESH BHAT
2012-12-04  6:09 KARTHIKVENKATESH BHAT

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=12507387.452971353338357020.JavaMail.weblogic@epml02 \
    --to=kv.bhat@samsung.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hjl.tools@gmail.com \
    /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