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]

[RFA/sparc] Add handling of stack-check probes


Hello,

GDB is currently unable to unwind past stack-check probes that are
inserted by the compiler when compiling with -stack-check. The attached
patch adds handling for the sequences currently emitted by GCC. Eric
Botcazou told us that they can take 3 forms:

    1. A single probe
    
      sethi <some immediate>,%g1
      sub   %sp, %g1, %g1
      clr [%g1 - some immediate]
    
    2. A small number of probes (at most 5)
    
      sethi <some immediate>,%g1
      sub   %sp, %g1, %g1
      clr [%g1]
      add   %g1, -<some immediate>, %g1
      clr [%g1]
    [...]
      add   %g1, -<some immediate>, %g1
      clr [%g1]
      clr [%g1 - some immediate]
    
    3. A probing loop
    
      sethi  <some immediate>,%g1
      sub  %sp, %g1, %g1
      sethi  <some immediate>, %g4
      sub  %g1, %g4, %g4
      cmp  %g1, %g4
      be  <disp>
        add  %g1, -<some immediate>, %g1
      ba  <disp>
        clr  [%g1]
      clr [%g4 - some immediate]

2007-03-28  Joel Brobecker  <brobecker@adacore.com>

        * sparc-tdep.c (X_RS2): New macro.
        (sparc_skip_stack_check): New function.
        (sparc_analyze_prologue): Adjust PC past stack probing
        sequence if necessary.

Tested on sparc-solaris, no regression.
OK to apply?

Thanks,
-- 
Joel

PS: Do other people think that it is simpler for the human brain to understand
        if (pc >= current_pc)
    than 
        if (current_pc <= pc)

    In other words, the boundary value is put on the rhs of the condition,
    and the variable value is put on the lhs... It's just an aesthetic
    consideration, but I can change it if others agree.

Attachment: stack-check.diff
Description: Text document


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