* lin-lwp.c (stop_wait_callback): Remove bogus assertions in the
[deliverable/binutils-gdb.git] / gdb / i386-tdep.c
index 03c4cf3bd5f367b82b735904987f0c0c34da02eb..8aaf651dba330ac336bbe20993fea24a404bb9c6 100644 (file)
 #include "symtab.h"
 #include "gdbcmd.h"
 #include "command.h"
+#include "arch-utils.h"
 
-static long i386_get_frame_setup PARAMS ((CORE_ADDR));
+static long i386_get_frame_setup (CORE_ADDR);
 
-static void i386_follow_jump PARAMS ((void));
+static void i386_follow_jump (void);
 
-static void codestream_read PARAMS ((unsigned char *, int));
+static void codestream_read (unsigned char *, int);
 
-static void codestream_seek PARAMS ((CORE_ADDR));
+static void codestream_seek (CORE_ADDR);
 
-static unsigned char codestream_fill PARAMS ((int));
+static unsigned char codestream_fill (int);
 
-CORE_ADDR skip_trampoline_code PARAMS ((CORE_ADDR, char *));
+CORE_ADDR skip_trampoline_code (CORE_ADDR, char *);
 
 static int gdb_print_insn_i386 (bfd_vma, disassemble_info *);
 
-void _initialize_i386_tdep PARAMS ((void));
+void _initialize_i386_tdep (void);
 
 /* i386_register_byte[i] is the offset into the register file of the
    start of register number i.  We initialize this from
@@ -74,21 +75,22 @@ int i386_register_virtual_size[MAX_NUM_REGS];
 
 /* This is the variable the is set with "set disassembly-flavor",
    and its legitimate values. */
-static char att_flavor[] = "att";
-static char intel_flavor[] = "intel";
-static char *valid_flavors[] =
+static const char att_flavor[] = "att";
+static const char intel_flavor[] = "intel";
+static const char *valid_flavors[] =
 {
   att_flavor,
   intel_flavor,
   NULL
 };
-static char *disassembly_flavor = att_flavor;
+static const char *disassembly_flavor = att_flavor;
 
-static void i386_print_register PARAMS ((char *, int, int));
+static void i386_print_register (char *, int, int);
 
 /* This is used to keep the bfd arch_info in sync with the disassembly flavor.  */
-static void set_disassembly_flavor_sfunc PARAMS ((char *, int, struct cmd_list_element *));
-static void set_disassembly_flavor PARAMS ((void));
+static void set_disassembly_flavor_sfunc (char *, int,
+                                         struct cmd_list_element *);
+static void set_disassembly_flavor (void);
 
 /* Stdio style buffering was used to minimize calls to ptrace, but this
    buffering did not take into account that the code section being accessed
@@ -121,8 +123,7 @@ static int codestream_cnt;
                         codestream_fill(0) : codestream_buf[codestream_off++])
 
 static unsigned char
-codestream_fill (peek_flag)
-     int peek_flag;
+codestream_fill (int peek_flag)
 {
   codestream_addr = codestream_next_addr;
   codestream_next_addr += CODESTREAM_BUFSIZ;
@@ -137,8 +138,7 @@ codestream_fill (peek_flag)
 }
 
 static void
-codestream_seek (place)
-     CORE_ADDR place;
+codestream_seek (CORE_ADDR place)
 {
   codestream_next_addr = place / CODESTREAM_BUFSIZ;
   codestream_next_addr *= CODESTREAM_BUFSIZ;
@@ -149,9 +149,7 @@ codestream_seek (place)
 }
 
 static void
-codestream_read (buf, count)
-     unsigned char *buf;
-     int count;
+codestream_read (unsigned char *buf, int count)
 {
   unsigned char *p;
   int i;
@@ -163,7 +161,7 @@ codestream_read (buf, count)
 /* next instruction is a jump, move to target */
 
 static void
-i386_follow_jump ()
+i386_follow_jump (void)
 {
   unsigned char buf[4];
   long delta;
@@ -221,8 +219,7 @@ i386_follow_jump ()
  */
 
 static long
-i386_get_frame_setup (pc)
-     CORE_ADDR pc;
+i386_get_frame_setup (CORE_ADDR pc)
 {
   unsigned char op;
 
@@ -373,8 +370,7 @@ i386_get_frame_setup (pc)
    Can return -1, meaning no way to tell.  */
 
 int
-i386_frame_num_args (fi)
-     struct frame_info *fi;
+i386_frame_num_args (struct frame_info *fi)
 {
 #if 1
   return -1;
@@ -475,8 +471,7 @@ i386_frame_num_args (fi)
  */
 
 void
-i386_frame_init_saved_regs (fip)
-     struct frame_info *fip;
+i386_frame_init_saved_regs (struct frame_info *fip)
 {
   long locals = -1;
   unsigned char op;
@@ -537,8 +532,7 @@ i386_frame_init_saved_regs (fip)
 /* return pc of first real instruction */
 
 int
-i386_skip_prologue (pc)
-     int pc;
+i386_skip_prologue (int pc)
 {
   unsigned char op;
   int i;
@@ -619,7 +613,7 @@ i386_skip_prologue (pc)
 }
 
 void
-i386_push_dummy_frame ()
+i386_push_dummy_frame (void)
 {
   CORE_ADDR sp = read_register (SP_REGNUM);
   int regnum;
@@ -636,8 +630,28 @@ i386_push_dummy_frame ()
   write_register (SP_REGNUM, sp);
 }
 
+/* Insert the (relative) function address into the call sequence
+   stored at DYMMY.  */
+
+void
+i386_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+                    value_ptr *args, struct type *type, int gcc_p)
+{
+  int from, to, delta, loc;
+
+  loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH);
+  from = loc + 5;
+  to = (int)(fun);
+  delta = to - from;
+
+  *((char *)(dummy) + 1) = (delta & 0xff);
+  *((char *)(dummy) + 2) = ((delta >> 8) & 0xff);
+  *((char *)(dummy) + 3) = ((delta >> 16) & 0xff);
+  *((char *)(dummy) + 4) = ((delta >> 24) & 0xff);
+}
+
 void
-i386_pop_frame ()
+i386_pop_frame (void)
 {
   struct frame_info *frame = get_current_frame ();
   CORE_ADDR fp;
@@ -672,8 +686,7 @@ i386_pop_frame ()
    This routine returns true on success. */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
   char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
   CORE_ADDR sp, jb_addr;
@@ -792,8 +805,7 @@ i386_register_convert_to_raw (struct type *type, int regnum,
    for all three variants of SVR4 sigtramps.  */
 
 CORE_ADDR
-i386v4_sigtramp_saved_pc (frame)
-     struct frame_info *frame;
+i386v4_sigtramp_saved_pc (struct frame_info *frame)
 {
   CORE_ADDR saved_pc_offset = 4;
   char *name = NULL;
@@ -821,8 +833,7 @@ i386v4_sigtramp_saved_pc (frame)
    it is done for C too.  */
 
 char *
-sunpro_static_transform_name (name)
-     char *name;
+sunpro_static_transform_name (char *name)
 {
   char *p;
   if (IS_STATIC_TRANSFORM_NAME (name))
@@ -847,9 +858,7 @@ sunpro_static_transform_name (name)
 /* Stuff for WIN32 PE style DLL's but is pretty generic really. */
 
 CORE_ADDR
-skip_trampoline_code (pc, name)
-     CORE_ADDR pc;
-     char *name;
+skip_trampoline_code (CORE_ADDR pc, char *name)
 {
   if (pc && read_memory_unsigned_integer (pc, 2) == 0x25ff)    /* jmp *(dest) */
     {
@@ -869,9 +878,7 @@ skip_trampoline_code (pc, name)
 }
 
 static int
-gdb_print_insn_i386 (memaddr, info)
-     bfd_vma memaddr;
-     disassemble_info *info;
+gdb_print_insn_i386 (bfd_vma memaddr, disassemble_info *info)
 {
   if (disassembly_flavor == att_flavor)
     return print_insn_i386_att (memaddr, info);
@@ -887,16 +894,14 @@ gdb_print_insn_i386 (memaddr, info)
    command, and does that.  */
 
 static void
-set_disassembly_flavor_sfunc (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_disassembly_flavor_sfunc (char *args, int from_tty,
+                             struct cmd_list_element *c)
 {
   set_disassembly_flavor ();
 }
 
 static void
-set_disassembly_flavor ()
+set_disassembly_flavor (void)
 {
   if (disassembly_flavor == att_flavor)
     set_architecture_from_arch_mach (bfd_arch_i386, bfd_mach_i386_i386);
@@ -906,7 +911,7 @@ set_disassembly_flavor ()
 
 
 void
-_initialize_i386_tdep ()
+_initialize_i386_tdep (void)
 {
   /* Initialize the table saying where each register starts in the
      register file.  */
This page took 0.026728 seconds and 4 git commands to generate.