This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix for incorect breakpoint set in case of clang compiled binary


> Date: Tue, 04 Dec 2012 06:09:29 +0000 (GMT)
> From: KARTHIKVENKATESH BHAT <kv.bhat@samsung.com>
> 
> Hi Mark/Tom/Palves,
> Thanks for taking your time out for review.
> I have implemented the review comments. Please let me know if i can commit the same.
> 
> cvs diff: Diffing .
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/src/src/gdb/ChangeLog,v
> retrieving revision 1.14880
> diff -u -p -r1.14880 ChangeLog
> --- ChangeLog	3 Dec 2012 22:31:02 -0000	1.14880
> +++ ChangeLog	4 Dec 2012 05:06:29 -0000
> @@ -1,3 +1,10 @@
> +2012-12-04  Karthik Bhat  <kv.bhat@samsung.com>
> +
> +	* i386-tdep.c (i386_skip_prologue): Using symbol table
> +	to find the end of prologue for clang compiled binaries.
> +	* amd64-tdep.c (amd64_skip_prologue):Using symbol table
> +	to find the end of prologue for clang compiled binaries.

Missing space between : and Using in your ChangeLog entry.  Otherwise
this looks ok to me.

> Index: amd64-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/amd64-tdep.c,v
> retrieving revision 1.115
> diff -u -p -r1.115 amd64-tdep.c
> --- amd64-tdep.c	26 Oct 2012 19:34:09 -0000	1.115
> +++ amd64-tdep.c	4 Dec 2012 05:06:30 -0000
> @@ -2252,6 +2252,22 @@ amd64_skip_prologue (struct gdbarch *gdb
>  {
>    struct amd64_frame_cache cache;
>    CORE_ADDR pc;
> +  CORE_ADDR 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);
> +      struct symtab *s = find_pc_symtab (func_addr);
> +
> +      /* Clang always emits a line note before the prologue and another
> +	 one after.  We trust clang to emit usable line notes.  */
> +      if (post_prologue_pc
> +	  && (s != NULL
> +	      && s->producer != NULL
> +	      && strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0))
> +        return max (start_pc, post_prologue_pc);
> +    }
>  
>    amd64_init_frame_cache (&cache);
>    pc = amd64_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffLL,
> Index: i386-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/i386-tdep.c,v
> retrieving revision 1.364
> diff -u -p -r1.364 i386-tdep.c
> --- i386-tdep.c	21 Nov 2012 14:09:10 -0000	1.364
> +++ i386-tdep.c	4 Dec 2012 05:06:30 -0000
> @@ -1582,7 +1582,23 @@ i386_skip_prologue (struct gdbarch *gdba
>    CORE_ADDR pc;
>    gdb_byte op;
>    int i;
> +  CORE_ADDR 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);
> +      struct symtab *s = find_pc_symtab (func_addr);
> +
> +      /* Clang always emits a line note before the prologue and another
> +	 one after.  We trust clang to emit usable line notes.  */
> +      if (post_prologue_pc
> +	  && (s != NULL
> +	      && s->producer != NULL
> +	      && strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0))
> +        return max (start_pc, post_prologue_pc);
> +    }
> + 
>    cache.locals = -1;
>    pc = i386_analyze_prologue (gdbarch, start_pc, 0xffffffff, &cache);
>    if (cache.locals < 0)
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]