This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

Re: thumb_skip_prologue too adventurous


Jonathan,

Thanks.

I am not sure if there isn't a better solution for this, but for now I
would say that you should check your change in as an emergency fix.  I
am assuming you ran the testsuite and it did not cause any regressions,
right?  (I don't think it will cause any)

I may latter add another change to check first if there is information
about the prologue end in the symbol table.  I don't know why this was
not checked before, I just noticed it now, looking at you patch.

I wrote this thumb prologue scan code to match the new compiler (gcc)
prologue generation.  As everything is new, both Nick and I used the
testsuite results to verify our work. The case you mention does not have
a testsuite case.  I wonder if you could add a test case?

Regards,
Fernando

Jonathan Larmour wrote:
> 
> Jonathan Larmour wrote:
> > 2000-03-18  Jonathan Larmour  <jlarmour@redhat.co.uk>
> >
> >         * arm-tdep.c (thumb_skip_prologue): Take function end addr argument
> >         so that we can stop searching for the prologue past the function end
> >         (arm_skip_prologue): Call thumb_skip_prologue with function end addr
> 
> Doh! Patch attached.
> 
> Jifl
> 
>   ------------------------------------------------------------------------
> Index: arm-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/arm-tdep.c,v
> retrieving revision 1.4
> diff -u -5 -p -r1.4 arm-tdep.c
> --- arm-tdep.c  2000/02/29 07:23:02     1.4
> +++ arm-tdep.c  2000/03/18 22:16:21
> @@ -326,20 +326,20 @@ arm_frameless_function_invocation (struc
>     When we have found at least one of each class we are done with the prolog.
>     Note that the "sub sp, #NN" before the push does not count.
>     */
> 
>  static CORE_ADDR
> -thumb_skip_prologue (CORE_ADDR pc)
> +thumb_skip_prologue (CORE_ADDR pc, CORE_ADDR func_end)
>  {
>    CORE_ADDR current_pc;
>    int findmask = 0;    /* findmask:
>                            bit 0 - push { rlist }
>                            bit 1 - mov r7, sp  OR  add r7, sp, #imm  (setting of r7)
>                            bit 2 - sub sp, #simm  OR  add sp, #simm  (adjusting of sp)
>                         */
> 
> -  for (current_pc = pc; current_pc < pc + 40; current_pc += 2)
> +  for (current_pc = pc; current_pc + 2 < func_end && current_pc < pc + 40; current_pc += 2)
>      {
>        unsigned short insn = read_memory_unsigned_integer (current_pc, 2);
> 
>        if ((insn & 0xfe00) == 0xb400)   /* push { rlist } */
>         {
> @@ -397,11 +397,11 @@ arm_skip_prologue (CORE_ADDR pc)
>         return sal.end;
>      }
> 
>    /* Check if this is Thumb code.  */
>    if (arm_pc_is_thumb (pc))
> -    return thumb_skip_prologue (pc);
> +    return thumb_skip_prologue (pc, func_end);
> 
>    /* Can't find the prologue end in the symbol table, try it the hard way
>       by disassembling the instructions. */
>    skip_pc = pc;
>    inst = read_memory_integer (skip_pc, 4);

-- 
Fernando Nasser
Red Hat, Inc. - Toronto                 E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
Toronto, Ontario   M4P 2C9              Fax:  416-482-6299

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