640-debian_dwarf2-frame-signal-unwinder.patch 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. Status: Checked in to HEAD after 6.3.
  2. 2004-11-07 Daniel Jacobowitz <dan@debian.org>
  3. * dwarf2-frame.c (struct dwarf2_frame_ops): Add signal_frame_p.
  4. (dwarf2_frame_set_signal_frame_p, dwarf2_frame_signal_frame_p)
  5. (dwarf2_signal_frame_unwind): New.
  6. (dwarf2_frame_sniffer): Use dwarf2_frame_signal_frame_p.
  7. * dwarf2-frame.h (dwarf2_frame_set_signal_frame_p): New prototype.
  8. Index: src/gdb/dwarf2-frame.c
  9. ===================================================================
  10. RCS file: /big/fsf/rsync/src-cvs/src/gdb/dwarf2-frame.c,v
  11. retrieving revision 1.41
  12. diff -u -p -r1.41 dwarf2-frame.c
  13. --- src/gdb/dwarf2-frame.c 4 Nov 2004 21:15:15 -0000 1.41
  14. +++ src/gdb/dwarf2-frame.c 7 Nov 2004 17:41:58 -0000
  15. @@ -471,6 +471,10 @@ struct dwarf2_frame_ops
  16. {
  17. /* Pre-initialize the register state REG for register REGNUM. */
  18. void (*init_reg) (struct gdbarch *, int, struct dwarf2_frame_state_reg *);
  19. +
  20. + /* Check whether the frame preceding NEXT_FRAME will be a signal
  21. + trampoline. */
  22. + int (*signal_frame_p) (struct gdbarch *, struct frame_info *);
  23. };
  24. /* Default architecture-specific register state initialization
  25. @@ -547,6 +551,33 @@ dwarf2_frame_init_reg (struct gdbarch *g
  26. ops->init_reg (gdbarch, regnum, reg);
  27. }
  28. +
  29. +/* Set the architecture-specific signal trampoline recognition
  30. + function for GDBARCH to SIGNAL_FRAME_P. */
  31. +
  32. +void
  33. +dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
  34. + int (*signal_frame_p) (struct gdbarch *,
  35. + struct frame_info *))
  36. +{
  37. + struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
  38. +
  39. + ops->signal_frame_p = signal_frame_p;
  40. +}
  41. +
  42. +/* Query the architecture-specific signal frame recognizer for
  43. + NEXT_FRAME. */
  44. +
  45. +static int
  46. +dwarf2_frame_signal_frame_p (struct gdbarch *gdbarch,
  47. + struct frame_info *next_frame)
  48. +{
  49. + struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
  50. +
  51. + if (ops->signal_frame_p == NULL)
  52. + return 0;
  53. + return ops->signal_frame_p (gdbarch, next_frame);
  54. +}
  55. struct dwarf2_frame_cache
  56. @@ -841,6 +872,13 @@ static const struct frame_unwind dwarf2_
  57. dwarf2_frame_prev_register
  58. };
  59. +static const struct frame_unwind dwarf2_signal_frame_unwind =
  60. +{
  61. + SIGTRAMP_FRAME,
  62. + dwarf2_frame_this_id,
  63. + dwarf2_frame_prev_register
  64. +};
  65. +
  66. const struct frame_unwind *
  67. dwarf2_frame_sniffer (struct frame_info *next_frame)
  68. {
  69. @@ -848,10 +886,18 @@ dwarf2_frame_sniffer (struct frame_info
  70. function. frame_pc_unwind(), for a no-return next function, can
  71. end up returning something past the end of this function's body. */
  72. CORE_ADDR block_addr = frame_unwind_address_in_block (next_frame);
  73. - if (dwarf2_frame_find_fde (&block_addr))
  74. - return &dwarf2_frame_unwind;
  75. + if (!dwarf2_frame_find_fde (&block_addr))
  76. + return NULL;
  77. - return NULL;
  78. + /* On some targets, signal trampolines may have unwind information.
  79. + We need to recognize them so that we set the frame type
  80. + correctly. */
  81. +
  82. + if (dwarf2_frame_signal_frame_p (get_frame_arch (next_frame),
  83. + next_frame))
  84. + return &dwarf2_signal_frame_unwind;
  85. +
  86. + return &dwarf2_frame_unwind;
  87. }
  88. Index: src/gdb/dwarf2-frame.h
  89. ===================================================================
  90. RCS file: /big/fsf/rsync/src-cvs/src/gdb/dwarf2-frame.h,v
  91. retrieving revision 1.6
  92. diff -u -p -r1.6 dwarf2-frame.h
  93. --- src/gdb/dwarf2-frame.h 28 Feb 2004 16:59:32 -0000 1.6
  94. +++ src/gdb/dwarf2-frame.h 7 Nov 2004 17:40:41 -0000
  95. @@ -79,6 +79,14 @@ extern void dwarf2_frame_set_init_reg (s
  96. void (*init_reg) (struct gdbarch *, int,
  97. struct dwarf2_frame_state_reg *));
  98. +/* Set the architecture-specific signal trampoline recognition
  99. + function for GDBARCH to SIGNAL_FRAME_P. */
  100. +
  101. +extern void
  102. + dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
  103. + int (*signal_frame_p) (struct gdbarch *,
  104. + struct frame_info *));
  105. +
  106. /* Return the frame unwind methods for the function that contains PC,
  107. or NULL if it can't be handled by DWARF CFI frame unwinder. */