home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / gdb / config / i386 / tm-i386v4.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-09  |  4.1 KB  |  115 lines

  1. /* Macro definitions for GDB on an Intel i386 running SVR4.
  2.    Copyright (C) 1991, 1994 Free Software Foundation, Inc.
  3.    Written by Fred Fish at Cygnus Support (fnf@cygint)
  4.  
  5. This file is part of GDB.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /* Use the alternate method of determining valid frame chains. */
  22.  
  23. #define FRAME_CHAIN_VALID_ALTERNATE
  24.  
  25. /* number of traps that happen between exec'ing the shell 
  26.  * to run an inferior, and when we finally get to 
  27.  * the inferior code.  This is 2 on most implementations.
  28.  */
  29. #define START_INFERIOR_TRAPS_EXPECTED 2
  30.  
  31. /* Pick up most of what we need from the generic i386 target include file. */
  32.  
  33. #include "i386/tm-i386v.h"
  34.  
  35. /* Pick up more stuff from the generic SVR4 host include file. */
  36.  
  37. #include "tm-sysv4.h"
  38.  
  39. /* We can't tell how many args there are
  40.    now that the C compiler delays popping them.  */
  41.  
  42. #undef FRAME_NUM_ARGS
  43. #define FRAME_NUM_ARGS(val,fi) (val = -1)
  44.  
  45. /* Offsets (in target ints) into jmp_buf.  Not defined in any system header
  46.    file, so we have to step through setjmp/longjmp with a debugger and figure
  47.    them out.  Note that <setjmp> defines _JBLEN as 10, which is the default
  48.    if no specific machine is selected, even though we only use 6 slots. */
  49.  
  50. #define JB_ELEMENT_SIZE sizeof(int)    /* jmp_buf[_JBLEN] is array of ints */
  51.  
  52. #define JB_EBX    0
  53. #define JB_ESI    1
  54. #define JB_EDI    2
  55. #define JB_EBP    3
  56. #define JB_ESP    4
  57. #define JB_EDX    5
  58.  
  59. #define JB_PC    JB_EDX    /* Setjmp()'s return PC saved in EDX */
  60.  
  61. /* Figure out where the longjmp will land.  Slurp the args out of the stack.
  62.    We expect the first arg to be a pointer to the jmp_buf structure from which
  63.    we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
  64.    This routine returns true on success */
  65.  
  66. extern int
  67. get_longjmp_target PARAMS ((CORE_ADDR *));
  68.  
  69. #define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
  70.  
  71. /* The following redefines make backtracing through sigtramp work.
  72.    They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp
  73.    from the ucontext structure which is pushed by the kernel on the
  74.    user stack. Unfortunately there are three variants of sigtramp handlers.  */
  75.  
  76. #define I386V4_SIGTRAMP_SAVED_PC
  77. #define IN_SIGTRAMP(pc, name) ((name)                    \
  78.                    && (STREQ ("_sigreturn", name)        \
  79.                    || STREQ ("_sigacthandler", name)    \
  80.                    || STREQ ("sigvechandler", name)))
  81.  
  82. /* FRAME_CHAIN takes a frame's nominal address and produces the frame's
  83.    chain-pointer.
  84.    In the case of the i386, the frame's nominal address
  85.    is the address of a 4-byte word containing the calling frame's address.  */
  86. #undef FRAME_CHAIN
  87. #define FRAME_CHAIN(thisframe)  \
  88.   ((thisframe)->signal_handler_caller \
  89.    ? (thisframe)->frame \
  90.    : (!inside_entry_file ((thisframe)->pc) \
  91.       ? read_memory_integer ((thisframe)->frame, 4) \
  92.       : 0))
  93.  
  94. /* A macro that tells us whether the function invocation represented
  95.    by FI does not have a frame on the stack associated with it.  If it
  96.    does not, FRAMELESS is set to 1, else 0.  */
  97. #undef FRAMELESS_FUNCTION_INVOCATION
  98. #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
  99.   do { \
  100.     if ((FI)->signal_handler_caller) \
  101.       (FRAMELESS) = 0; \
  102.     else \
  103.       (FRAMELESS) = frameless_look_for_prologue(FI); \
  104.   } while (0)
  105.  
  106. /* Saved Pc.  Get it from ucontext if within sigtramp.  */
  107.  
  108. #undef FRAME_SAVED_PC
  109. #define FRAME_SAVED_PC(FRAME) \
  110.   (((FRAME)->signal_handler_caller \
  111.     ? i386v4_sigtramp_saved_pc (FRAME) \
  112.     : read_memory_integer ((FRAME)->frame + 4, 4)) \
  113.    )
  114. extern CORE_ADDR i386v4_sigtramp_saved_pc PARAMS ((struct frame_info *));
  115.