1 /* Intel 386 target-dependent stuff.
3 Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
4 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 #include "gdb_string.h"
29 #include "floatformat.h"
34 #include "arch-utils.h"
38 #include "gdb_assert.h"
40 #include "i386-tdep.h"
42 /* Names of the registers. The first 10 registers match the register
43 numbering scheme used by GCC for stabs and DWARF. */
44 static char *i386_register_names
[] =
46 "eax", "ecx", "edx", "ebx",
47 "esp", "ebp", "esi", "edi",
48 "eip", "eflags", "cs", "ss",
49 "ds", "es", "fs", "gs",
50 "st0", "st1", "st2", "st3",
51 "st4", "st5", "st6", "st7",
52 "fctrl", "fstat", "ftag", "fiseg",
53 "fioff", "foseg", "fooff", "fop",
54 "xmm0", "xmm1", "xmm2", "xmm3",
55 "xmm4", "xmm5", "xmm6", "xmm7",
59 /* i386_register_offset[i] is the offset into the register file of the
60 start of register number i. We initialize this from
61 i386_register_size. */
62 static int i386_register_offset
[I386_SSE_NUM_REGS
];
64 /* i386_register_size[i] is the number of bytes of storage in GDB's
65 register array occupied by register i. */
66 static int i386_register_size
[I386_SSE_NUM_REGS
] = {
80 /* Return the name of register REG. */
83 i386_register_name (int reg
)
87 if (reg
>= sizeof (i386_register_names
) / sizeof (*i386_register_names
))
90 return i386_register_names
[reg
];
93 /* Return the offset into the register array of the start of register
96 i386_register_byte (int reg
)
98 return i386_register_offset
[reg
];
101 /* Return the number of bytes of storage in GDB's register array
102 occupied by register REG. */
105 i386_register_raw_size (int reg
)
107 return i386_register_size
[reg
];
110 /* Convert stabs register number REG to the appropriate register
111 number used by GDB. */
114 i386_stab_reg_to_regnum (int reg
)
116 /* This implements what GCC calls the "default" register map. */
117 if (reg
>= 0 && reg
<= 7)
119 /* General registers. */
122 else if (reg
>= 12 && reg
<= 19)
124 /* Floating-point registers. */
125 return reg
- 12 + FP0_REGNUM
;
127 else if (reg
>= 21 && reg
<= 28)
130 return reg
- 21 + XMM0_REGNUM
;
132 else if (reg
>= 29 && reg
<= 36)
135 /* FIXME: kettenis/2001-07-28: Should we have the MMX registers
136 as pseudo-registers? */
137 return reg
- 29 + FP0_REGNUM
;
140 /* This will hopefully provoke a warning. */
141 return NUM_REGS
+ NUM_PSEUDO_REGS
;
144 /* Convert DWARF register number REG to the appropriate register
145 number used by GDB. */
148 i386_dwarf_reg_to_regnum (int reg
)
150 /* The DWARF register numbering includes %eip and %eflags, and
151 numbers the floating point registers differently. */
152 if (reg
>= 0 && reg
<= 9)
154 /* General registers. */
157 else if (reg
>= 11 && reg
<= 18)
159 /* Floating-point registers. */
160 return reg
- 11 + FP0_REGNUM
;
164 /* The SSE and MMX registers have identical numbers as in stabs. */
165 return i386_stab_reg_to_regnum (reg
);
168 /* This will hopefully provoke a warning. */
169 return NUM_REGS
+ NUM_PSEUDO_REGS
;
173 /* This is the variable that is set with "set disassembly-flavor", and
174 its legitimate values. */
175 static const char att_flavor
[] = "att";
176 static const char intel_flavor
[] = "intel";
177 static const char *valid_flavors
[] =
183 static const char *disassembly_flavor
= att_flavor
;
185 /* Stdio style buffering was used to minimize calls to ptrace, but
186 this buffering did not take into account that the code section
187 being accessed may not be an even number of buffers long (even if
188 the buffer is only sizeof(int) long). In cases where the code
189 section size happened to be a non-integral number of buffers long,
190 attempting to read the last buffer would fail. Simply using
191 target_read_memory and ignoring errors, rather than read_memory, is
192 not the correct solution, since legitimate access errors would then
193 be totally ignored. To properly handle this situation and continue
194 to use buffering would require that this code be able to determine
195 the minimum code section size granularity (not the alignment of the
196 section itself, since the actual failing case that pointed out this
197 problem had a section alignment of 4 but was not a multiple of 4
198 bytes long), on a target by target basis, and then adjust it's
199 buffer size accordingly. This is messy, but potentially feasible.
200 It probably needs the bfd library's help and support. For now, the
201 buffer size is set to 1. (FIXME -fnf) */
203 #define CODESTREAM_BUFSIZ 1 /* Was sizeof(int), see note above. */
204 static CORE_ADDR codestream_next_addr
;
205 static CORE_ADDR codestream_addr
;
206 static unsigned char codestream_buf
[CODESTREAM_BUFSIZ
];
207 static int codestream_off
;
208 static int codestream_cnt
;
210 #define codestream_tell() (codestream_addr + codestream_off)
211 #define codestream_peek() \
212 (codestream_cnt == 0 ? \
213 codestream_fill(1) : codestream_buf[codestream_off])
214 #define codestream_get() \
215 (codestream_cnt-- == 0 ? \
216 codestream_fill(0) : codestream_buf[codestream_off++])
219 codestream_fill (int peek_flag
)
221 codestream_addr
= codestream_next_addr
;
222 codestream_next_addr
+= CODESTREAM_BUFSIZ
;
224 codestream_cnt
= CODESTREAM_BUFSIZ
;
225 read_memory (codestream_addr
, (char *) codestream_buf
, CODESTREAM_BUFSIZ
);
228 return (codestream_peek ());
230 return (codestream_get ());
234 codestream_seek (CORE_ADDR place
)
236 codestream_next_addr
= place
/ CODESTREAM_BUFSIZ
;
237 codestream_next_addr
*= CODESTREAM_BUFSIZ
;
240 while (codestream_tell () != place
)
245 codestream_read (unsigned char *buf
, int count
)
250 for (i
= 0; i
< count
; i
++)
251 *p
++ = codestream_get ();
255 /* If the next instruction is a jump, move to its target. */
258 i386_follow_jump (void)
260 unsigned char buf
[4];
266 pos
= codestream_tell ();
269 if (codestream_peek () == 0x66)
275 switch (codestream_get ())
278 /* Relative jump: if data16 == 0, disp32, else disp16. */
281 codestream_read (buf
, 2);
282 delta
= extract_signed_integer (buf
, 2);
284 /* Include the size of the jmp instruction (including the
290 codestream_read (buf
, 4);
291 delta
= extract_signed_integer (buf
, 4);
297 /* Relative jump, disp8 (ignore data16). */
298 codestream_read (buf
, 1);
299 /* Sign-extend it. */
300 delta
= extract_signed_integer (buf
, 1);
305 codestream_seek (pos
);
308 /* Find & return the amount a local space allocated, and advance the
309 codestream to the first register push (if any).
311 If the entry sequence doesn't make sense, return -1, and leave
312 codestream pointer at a random spot. */
315 i386_get_frame_setup (CORE_ADDR pc
)
319 codestream_seek (pc
);
323 op
= codestream_get ();
325 if (op
== 0x58) /* popl %eax */
327 /* This function must start with
330 xchgl %eax, (%esp) 0x87 0x04 0x24
331 or xchgl %eax, 0(%esp) 0x87 0x44 0x24 0x00
333 (the System V compiler puts out the second `xchg'
334 instruction, and the assembler doesn't try to optimize it, so
335 the 'sib' form gets generated). This sequence is used to get
336 the address of the return buffer for a function that returns
339 unsigned char buf
[4];
340 static unsigned char proto1
[3] = { 0x87, 0x04, 0x24 };
341 static unsigned char proto2
[4] = { 0x87, 0x44, 0x24, 0x00 };
343 pos
= codestream_tell ();
344 codestream_read (buf
, 4);
345 if (memcmp (buf
, proto1
, 3) == 0)
347 else if (memcmp (buf
, proto2
, 4) == 0)
350 codestream_seek (pos
);
351 op
= codestream_get (); /* Update next opcode. */
354 if (op
== 0x68 || op
== 0x6a)
356 /* This function may start with
368 unsigned char buf
[8];
370 /* Skip past the `pushl' instruction; it has either a one-byte
371 or a four-byte operand, depending on the opcode. */
372 pos
= codestream_tell ();
377 codestream_seek (pos
);
379 /* Read the following 8 bytes, which should be "call _probe" (6
380 bytes) followed by "addl $4,%esp" (2 bytes). */
381 codestream_read (buf
, sizeof (buf
));
382 if (buf
[0] == 0xe8 && buf
[6] == 0xc4 && buf
[7] == 0x4)
384 codestream_seek (pos
);
385 op
= codestream_get (); /* Update next opcode. */
388 if (op
== 0x55) /* pushl %ebp */
390 /* Check for "movl %esp, %ebp" -- can be written in two ways. */
391 switch (codestream_get ())
394 if (codestream_get () != 0xec)
398 if (codestream_get () != 0xe5)
404 /* Check for stack adjustment
408 NOTE: You can't subtract a 16 bit immediate from a 32 bit
409 reg, so we don't have to worry about a data16 prefix. */
410 op
= codestream_peek ();
413 /* `subl' with 8 bit immediate. */
415 if (codestream_get () != 0xec)
416 /* Some instruction starting with 0x83 other than `subl'. */
418 codestream_seek (codestream_tell () - 2);
421 /* `subl' with signed byte immediate (though it wouldn't
422 make sense to be negative). */
423 return (codestream_get ());
428 /* Maybe it is `subl' with a 32 bit immedediate. */
430 if (codestream_get () != 0xec)
431 /* Some instruction starting with 0x81 other than `subl'. */
433 codestream_seek (codestream_tell () - 2);
436 /* It is `subl' with a 32 bit immediate. */
437 codestream_read ((unsigned char *) buf
, 4);
438 return extract_signed_integer (buf
, 4);
448 /* `enter' with 16 bit unsigned immediate. */
449 codestream_read ((unsigned char *) buf
, 2);
450 codestream_get (); /* Flush final byte of enter instruction. */
451 return extract_unsigned_integer (buf
, 2);
456 /* Signal trampolines don't have a meaningful frame. The frame
457 pointer value we use is actually the frame pointer of the calling
458 frame -- that is, the frame which was in progress when the signal
459 trampoline was entered. GDB mostly treats this frame pointer value
460 as a magic cookie. We detect the case of a signal trampoline by
461 looking at the SIGNAL_HANDLER_CALLER field, which is set based on
464 When a signal trampoline is invoked from a frameless function, we
465 essentially have two frameless functions in a row. In this case,
466 we use the same magic cookie for three frames in a row. We detect
467 this case by seeing whether the next frame has
468 SIGNAL_HANDLER_CALLER set, and, if it does, checking whether the
469 current frame is actually frameless. In this case, we need to get
470 the PC by looking at the SP register value stored in the signal
473 This should work in most cases except in horrible situations where
474 a signal occurs just as we enter a function but before the frame
475 has been set up. Incidentally, that's just what happens when we
476 call a function from GDB with a signal pending (there's a test in
477 the testsuite that makes this happen). Therefore we pretend that
478 we have a frameless function if we're stopped at the start of a
481 /* Return non-zero if we're dealing with a frameless signal, that is,
482 a signal trampoline invoked from a frameless function. */
485 i386_frameless_signal_p (struct frame_info
*frame
)
487 return (frame
->next
&& frame
->next
->signal_handler_caller
488 && (frameless_look_for_prologue (frame
)
489 || frame
->pc
== get_pc_function_start (frame
->pc
)));
492 /* Return the chain-pointer for FRAME. In the case of the i386, the
493 frame's nominal address is the address of a 4-byte word containing
494 the calling frame's address. */
497 i386_frame_chain (struct frame_info
*frame
)
499 if (PC_IN_CALL_DUMMY (frame
->pc
, 0, 0))
502 if (frame
->signal_handler_caller
503 || i386_frameless_signal_p (frame
))
506 if (! inside_entry_file (frame
->pc
))
507 return read_memory_unsigned_integer (frame
->frame
, 4);
512 /* Determine whether the function invocation represented by FRAME does
513 not have a from on the stack associated with it. If it does not,
514 return non-zero, otherwise return zero. */
517 i386_frameless_function_invocation (struct frame_info
*frame
)
519 if (frame
->signal_handler_caller
)
522 return frameless_look_for_prologue (frame
);
525 /* Assuming FRAME is for a sigtramp routine, return the saved program
529 i386_sigtramp_saved_pc (struct frame_info
*frame
)
531 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
534 addr
= tdep
->sigcontext_addr (frame
);
535 return read_memory_unsigned_integer (addr
+ tdep
->sc_pc_offset
, 4);
538 /* Assuming FRAME is for a sigtramp routine, return the saved stack
542 i386_sigtramp_saved_sp (struct frame_info
*frame
)
544 struct gdbarch_tdep
*tdep
= gdbarch_tdep (current_gdbarch
);
547 addr
= tdep
->sigcontext_addr (frame
);
548 return read_memory_unsigned_integer (addr
+ tdep
->sc_sp_offset
, 4);
551 /* Return the saved program counter for FRAME. */
554 i386_frame_saved_pc (struct frame_info
*frame
)
556 if (PC_IN_CALL_DUMMY (frame
->pc
, 0, 0))
557 return generic_read_register_dummy (frame
->pc
, frame
->frame
,
560 if (frame
->signal_handler_caller
)
561 return i386_sigtramp_saved_pc (frame
);
563 if (i386_frameless_signal_p (frame
))
565 CORE_ADDR sp
= i386_sigtramp_saved_sp (frame
->next
);
566 return read_memory_unsigned_integer (sp
, 4);
569 return read_memory_unsigned_integer (frame
->frame
+ 4, 4);
572 /* Immediately after a function call, return the saved pc. */
575 i386_saved_pc_after_call (struct frame_info
*frame
)
577 if (frame
->signal_handler_caller
)
578 return i386_sigtramp_saved_pc (frame
);
580 return read_memory_unsigned_integer (read_register (SP_REGNUM
), 4);
583 /* Return number of args passed to a frame.
584 Can return -1, meaning no way to tell. */
587 i386_frame_num_args (struct frame_info
*fi
)
592 /* This loses because not only might the compiler not be popping the
593 args right after the function call, it might be popping args from
594 both this call and a previous one, and we would say there are
595 more args than there really are. */
599 struct frame_info
*pfi
;
601 /* On the i386, the instruction following the call could be:
603 addl $imm, %esp - imm/4 args; imm may be 8 or 32 bits
604 anything else - zero args. */
608 frameless
= FRAMELESS_FUNCTION_INVOCATION (fi
);
610 /* In the absence of a frame pointer, GDB doesn't get correct
611 values for nameless arguments. Return -1, so it doesn't print
612 any nameless arguments. */
615 pfi
= get_prev_frame (fi
);
618 /* NOTE: This can happen if we are looking at the frame for
619 main, because FRAME_CHAIN_VALID won't let us go into start.
620 If we have debugging symbols, that's not really a big deal;
621 it just means it will only show as many arguments to main as
628 op
= read_memory_integer (retpc
, 1);
629 if (op
== 0x59) /* pop %ecx */
633 op
= read_memory_integer (retpc
+ 1, 1);
635 /* addl $<signed imm 8 bits>, %esp */
636 return (read_memory_integer (retpc
+ 2, 1) & 0xff) / 4;
640 else if (op
== 0x81) /* `add' with 32 bit immediate. */
642 op
= read_memory_integer (retpc
+ 1, 1);
644 /* addl $<imm 32>, %esp */
645 return read_memory_integer (retpc
+ 2, 4) / 4;
657 /* Parse the first few instructions the function to see what registers
660 We handle these cases:
662 The startup sequence can be at the start of the function, or the
663 function can start with a branch to startup code at the end.
665 %ebp can be set up with either the 'enter' instruction, or "pushl
666 %ebp, movl %esp, %ebp" (`enter' is too slow to be useful, but was
667 once used in the System V compiler).
669 Local space is allocated just below the saved %ebp by either the
670 'enter' instruction, or by "subl $<size>, %esp". 'enter' has a 16
671 bit unsigned argument for space to allocate, and the 'addl'
672 instruction could have either a signed byte, or 32 bit immediate.
674 Next, the registers used by this function are pushed. With the
675 System V compiler they will always be in the order: %edi, %esi,
676 %ebx (and sometimes a harmless bug causes it to also save but not
677 restore %eax); however, the code below is willing to see the pushes
678 in any order, and will handle up to 8 of them.
680 If the setup sequence is at the end of the function, then the next
681 instruction will be a branch back to the start. */
684 i386_frame_init_saved_regs (struct frame_info
*fip
)
695 frame_saved_regs_zalloc (fip
);
697 pc
= get_pc_function_start (fip
->pc
);
699 locals
= i386_get_frame_setup (pc
);
703 addr
= fip
->frame
- 4 - locals
;
704 for (i
= 0; i
< 8; i
++)
706 op
= codestream_get ();
707 if (op
< 0x50 || op
> 0x57)
709 #ifdef I386_REGNO_TO_SYMMETRY
710 /* Dynix uses different internal numbering. Ick. */
711 fip
->saved_regs
[I386_REGNO_TO_SYMMETRY (op
- 0x50)] = addr
;
713 fip
->saved_regs
[op
- 0x50] = addr
;
719 fip
->saved_regs
[PC_REGNUM
] = fip
->frame
+ 4;
720 fip
->saved_regs
[FP_REGNUM
] = fip
->frame
;
723 /* Return PC of first real instruction. */
726 i386_skip_prologue (CORE_ADDR pc
)
730 static unsigned char pic_pat
[6] =
731 { 0xe8, 0, 0, 0, 0, /* call 0x0 */
732 0x5b, /* popl %ebx */
736 if (i386_get_frame_setup (pc
) < 0)
739 /* Found valid frame setup -- codestream now points to start of push
740 instructions for saving registers. */
742 /* Skip over register saves. */
743 for (i
= 0; i
< 8; i
++)
745 op
= codestream_peek ();
746 /* Break if not `pushl' instrunction. */
747 if (op
< 0x50 || op
> 0x57)
752 /* The native cc on SVR4 in -K PIC mode inserts the following code
753 to get the address of the global offset table (GOT) into register
758 movl %ebx,x(%ebp) (optional)
761 This code is with the rest of the prologue (at the end of the
762 function), so we have to skip it to get to the first real
763 instruction at the start of the function. */
765 pos
= codestream_tell ();
766 for (i
= 0; i
< 6; i
++)
768 op
= codestream_get ();
769 if (pic_pat
[i
] != op
)
774 unsigned char buf
[4];
777 op
= codestream_get ();
778 if (op
== 0x89) /* movl %ebx, x(%ebp) */
780 op
= codestream_get ();
781 if (op
== 0x5d) /* One byte offset from %ebp. */
784 codestream_read (buf
, 1);
786 else if (op
== 0x9d) /* Four byte offset from %ebp. */
789 codestream_read (buf
, 4);
791 else /* Unexpected instruction. */
793 op
= codestream_get ();
796 if (delta
> 0 && op
== 0x81 && codestream_get () == 0xc3)
801 codestream_seek (pos
);
805 return (codestream_tell ());
808 /* Use the program counter to determine the contents and size of a
809 breakpoint instruction. Return a pointer to a string of bytes that
810 encode a breakpoint instruction, store the length of the string in
811 *LEN and optionally adjust *PC to point to the correct memory
812 location for inserting the breakpoint.
814 On the i386 we have a single breakpoint that fits in a single byte
815 and can be inserted anywhere. */
817 static const unsigned char *
818 i386_breakpoint_from_pc (CORE_ADDR
*pc
, int *len
)
820 static unsigned char break_insn
[] = { 0xcc }; /* int 3 */
822 *len
= sizeof (break_insn
);
826 /* Push the return address (pointing to the call dummy) onto the stack
827 and return the new value for the stack pointer. */
830 i386_push_return_address (CORE_ADDR pc
, CORE_ADDR sp
)
834 store_unsigned_integer (buf
, 4, CALL_DUMMY_ADDRESS ());
835 write_memory (sp
- 4, buf
, 4);
840 i386_do_pop_frame (struct frame_info
*frame
)
844 char regbuf
[I386_MAX_REGISTER_SIZE
];
846 fp
= FRAME_FP (frame
);
847 i386_frame_init_saved_regs (frame
);
849 for (regnum
= 0; regnum
< NUM_REGS
; regnum
++)
852 addr
= frame
->saved_regs
[regnum
];
855 read_memory (addr
, regbuf
, REGISTER_RAW_SIZE (regnum
));
856 write_register_bytes (REGISTER_BYTE (regnum
), regbuf
,
857 REGISTER_RAW_SIZE (regnum
));
860 write_register (FP_REGNUM
, read_memory_integer (fp
, 4));
861 write_register (PC_REGNUM
, read_memory_integer (fp
+ 4, 4));
862 write_register (SP_REGNUM
, fp
+ 8);
863 flush_cached_frames ();
867 i386_pop_frame (void)
869 generic_pop_current_frame (i386_do_pop_frame
);
873 /* Figure out where the longjmp will land. Slurp the args out of the
874 stack. We expect the first arg to be a pointer to the jmp_buf
875 structure from which we extract the address that we will land at.
876 This address is copied into PC. This routine returns true on
880 i386_get_longjmp_target (CORE_ADDR
*pc
)
883 CORE_ADDR sp
, jb_addr
;
884 int jb_pc_offset
= gdbarch_tdep (current_gdbarch
)->jb_pc_offset
;
886 /* If JB_PC_OFFSET is -1, we have no way to find out where the
887 longjmp will land. */
888 if (jb_pc_offset
== -1)
891 sp
= read_register (SP_REGNUM
);
892 if (target_read_memory (sp
+ 4, buf
, 4))
895 jb_addr
= extract_address (buf
, 4);
896 if (target_read_memory (jb_addr
+ jb_pc_offset
, buf
, 4))
899 *pc
= extract_address (buf
, 4);
905 i386_push_arguments (int nargs
, struct value
**args
, CORE_ADDR sp
,
906 int struct_return
, CORE_ADDR struct_addr
)
908 sp
= default_push_arguments (nargs
, args
, sp
, struct_return
, struct_addr
);
915 store_address (buf
, 4, struct_addr
);
916 write_memory (sp
, buf
, 4);
923 i386_store_struct_return (CORE_ADDR addr
, CORE_ADDR sp
)
925 /* Do nothing. Everything was already done by i386_push_arguments. */
928 /* These registers are used for returning integers (and on some
929 targets also for returning `struct' and `union' values when their
930 size and alignment match an integer type). */
931 #define LOW_RETURN_REGNUM 0 /* %eax */
932 #define HIGH_RETURN_REGNUM 2 /* %edx */
934 /* Extract from an array REGBUF containing the (raw) register state, a
935 function return value of TYPE, and copy that, in virtual format,
939 i386_extract_return_value (struct type
*type
, struct regcache
*regcache
,
942 int len
= TYPE_LENGTH (type
);
943 char buf
[I386_MAX_REGISTER_SIZE
];
945 if (TYPE_CODE (type
) == TYPE_CODE_STRUCT
946 && TYPE_NFIELDS (type
) == 1)
948 i386_extract_return_value (TYPE_FIELD_TYPE (type
, 0), regcache
, valbuf
);
952 if (TYPE_CODE (type
) == TYPE_CODE_FLT
)
956 warning ("Cannot find floating-point return value.");
957 memset (valbuf
, 0, len
);
961 /* Floating-point return values can be found in %st(0). Convert
962 its contents to the desired type. This is probably not
963 exactly how it would happen on the target itself, but it is
964 the best we can do. */
965 regcache_read (regcache
, FP0_REGNUM
, buf
);
966 convert_typed_floating (buf
, builtin_type_i387_ext
, valbuf
, type
);
970 int low_size
= REGISTER_RAW_SIZE (LOW_RETURN_REGNUM
);
971 int high_size
= REGISTER_RAW_SIZE (HIGH_RETURN_REGNUM
);
975 regcache_read (regcache
, LOW_RETURN_REGNUM
, buf
);
976 memcpy (valbuf
, buf
, len
);
978 else if (len
<= (low_size
+ high_size
))
980 regcache_read (regcache
, LOW_RETURN_REGNUM
, buf
);
981 memcpy (valbuf
, buf
, low_size
);
982 regcache_read (regcache
, HIGH_RETURN_REGNUM
, buf
);
983 memcpy (valbuf
+ low_size
, buf
, len
- low_size
);
986 internal_error (__FILE__
, __LINE__
,
987 "Cannot extract return value of %d bytes long.", len
);
991 /* Write into the appropriate registers a function return value stored
992 in VALBUF of type TYPE, given in virtual format. */
995 i386_store_return_value (struct type
*type
, char *valbuf
)
997 int len
= TYPE_LENGTH (type
);
999 if (TYPE_CODE (type
) == TYPE_CODE_STRUCT
1000 && TYPE_NFIELDS (type
) == 1)
1002 i386_store_return_value (TYPE_FIELD_TYPE (type
, 0), valbuf
);
1006 if (TYPE_CODE (type
) == TYPE_CODE_FLT
)
1009 char buf
[FPU_REG_RAW_SIZE
];
1011 if (FP0_REGNUM
== 0)
1013 warning ("Cannot set floating-point return value.");
1017 /* Returning floating-point values is a bit tricky. Apart from
1018 storing the return value in %st(0), we have to simulate the
1019 state of the FPU at function return point. */
1021 /* Convert the value found in VALBUF to the extended
1022 floating-point format used by the FPU. This is probably
1023 not exactly how it would happen on the target itself, but
1024 it is the best we can do. */
1025 convert_typed_floating (valbuf
, type
, buf
, builtin_type_i387_ext
);
1026 write_register_bytes (REGISTER_BYTE (FP0_REGNUM
), buf
,
1029 /* Set the top of the floating-point register stack to 7. The
1030 actual value doesn't really matter, but 7 is what a normal
1031 function return would end up with if the program started out
1032 with a freshly initialized FPU. */
1033 fstat
= read_register (FSTAT_REGNUM
);
1035 write_register (FSTAT_REGNUM
, fstat
);
1037 /* Mark %st(1) through %st(7) as empty. Since we set the top of
1038 the floating-point register stack to 7, the appropriate value
1039 for the tag word is 0x3fff. */
1040 write_register (FTAG_REGNUM
, 0x3fff);
1044 int low_size
= REGISTER_RAW_SIZE (LOW_RETURN_REGNUM
);
1045 int high_size
= REGISTER_RAW_SIZE (HIGH_RETURN_REGNUM
);
1047 if (len
<= low_size
)
1048 write_register_bytes (REGISTER_BYTE (LOW_RETURN_REGNUM
), valbuf
, len
);
1049 else if (len
<= (low_size
+ high_size
))
1051 write_register_bytes (REGISTER_BYTE (LOW_RETURN_REGNUM
),
1053 write_register_bytes (REGISTER_BYTE (HIGH_RETURN_REGNUM
),
1054 valbuf
+ low_size
, len
- low_size
);
1057 internal_error (__FILE__
, __LINE__
,
1058 "Cannot store return value of %d bytes long.", len
);
1062 /* Extract from an array REGBUF containing the (raw) register state
1063 the address in which a function should return its structure value,
1067 i386_extract_struct_value_address (struct regcache
*regcache
)
1069 return regcache_read_as_address (regcache
, LOW_RETURN_REGNUM
);
1073 /* This is the variable that is set with "set struct-convention", and
1074 its legitimate values. */
1075 static const char default_struct_convention
[] = "default";
1076 static const char pcc_struct_convention
[] = "pcc";
1077 static const char reg_struct_convention
[] = "reg";
1078 static const char *valid_conventions
[] =
1080 default_struct_convention
,
1081 pcc_struct_convention
,
1082 reg_struct_convention
,
1085 static const char *struct_convention
= default_struct_convention
;
1088 i386_use_struct_convention (int gcc_p
, struct type
*type
)
1090 enum struct_return struct_return
;
1092 if (struct_convention
== default_struct_convention
)
1093 struct_return
= gdbarch_tdep (current_gdbarch
)->struct_return
;
1094 else if (struct_convention
== pcc_struct_convention
)
1095 struct_return
= pcc_struct_return
;
1097 struct_return
= reg_struct_return
;
1099 return generic_use_struct_convention (struct_return
== reg_struct_return
,
1104 /* Return the GDB type object for the "standard" data type of data in
1105 register REGNUM. Perhaps %esi and %edi should go here, but
1106 potentially they could be used for things other than address. */
1108 static struct type
*
1109 i386_register_virtual_type (int regnum
)
1111 if (regnum
== PC_REGNUM
|| regnum
== FP_REGNUM
|| regnum
== SP_REGNUM
)
1112 return lookup_pointer_type (builtin_type_void
);
1114 if (IS_FP_REGNUM (regnum
))
1115 return builtin_type_i387_ext
;
1117 if (IS_SSE_REGNUM (regnum
))
1118 return builtin_type_vec128i
;
1120 return builtin_type_int
;
1123 /* Return true iff register REGNUM's virtual format is different from
1124 its raw format. Note that this definition assumes that the host
1125 supports IEEE 32-bit floats, since it doesn't say that SSE
1126 registers need conversion. Even if we can't find a counterexample,
1127 this is still sloppy. */
1130 i386_register_convertible (int regnum
)
1132 return IS_FP_REGNUM (regnum
);
1135 /* Convert data from raw format for register REGNUM in buffer FROM to
1136 virtual format with type TYPE in buffer TO. */
1139 i386_register_convert_to_virtual (int regnum
, struct type
*type
,
1140 char *from
, char *to
)
1142 gdb_assert (IS_FP_REGNUM (regnum
));
1144 /* We only support floating-point values. */
1145 if (TYPE_CODE (type
) != TYPE_CODE_FLT
)
1147 warning ("Cannot convert floating-point register value "
1148 "to non-floating-point type.");
1149 memset (to
, 0, TYPE_LENGTH (type
));
1153 /* Convert to TYPE. This should be a no-op if TYPE is equivalent to
1154 the extended floating-point format used by the FPU. */
1155 convert_typed_floating (from
, builtin_type_i387_ext
, to
, type
);
1158 /* Convert data from virtual format with type TYPE in buffer FROM to
1159 raw format for register REGNUM in buffer TO. */
1162 i386_register_convert_to_raw (struct type
*type
, int regnum
,
1163 char *from
, char *to
)
1165 gdb_assert (IS_FP_REGNUM (regnum
));
1167 /* We only support floating-point values. */
1168 if (TYPE_CODE (type
) != TYPE_CODE_FLT
)
1170 warning ("Cannot convert non-floating-point type "
1171 "to floating-point register value.");
1172 memset (to
, 0, TYPE_LENGTH (type
));
1176 /* Convert from TYPE. This should be a no-op if TYPE is equivalent
1177 to the extended floating-point format used by the FPU. */
1178 convert_typed_floating (from
, type
, to
, builtin_type_i387_ext
);
1182 #ifdef STATIC_TRANSFORM_NAME
1183 /* SunPRO encodes the static variables. This is not related to C++
1184 mangling, it is done for C too. */
1187 sunpro_static_transform_name (char *name
)
1190 if (IS_STATIC_TRANSFORM_NAME (name
))
1192 /* For file-local statics there will be a period, a bunch of
1193 junk (the contents of which match a string given in the
1194 N_OPT), a period and the name. For function-local statics
1195 there will be a bunch of junk (which seems to change the
1196 second character from 'A' to 'B'), a period, the name of the
1197 function, and the name. So just skip everything before the
1199 p
= strrchr (name
, '.');
1205 #endif /* STATIC_TRANSFORM_NAME */
1208 /* Stuff for WIN32 PE style DLL's but is pretty generic really. */
1211 skip_trampoline_code (CORE_ADDR pc
, char *name
)
1213 if (pc
&& read_memory_unsigned_integer (pc
, 2) == 0x25ff) /* jmp *(dest) */
1215 unsigned long indirect
= read_memory_unsigned_integer (pc
+ 2, 4);
1216 struct minimal_symbol
*indsym
=
1217 indirect
? lookup_minimal_symbol_by_pc (indirect
) : 0;
1218 char *symname
= indsym
? SYMBOL_NAME (indsym
) : 0;
1222 if (strncmp (symname
, "__imp_", 6) == 0
1223 || strncmp (symname
, "_imp_", 5) == 0)
1224 return name
? 1 : read_memory_unsigned_integer (indirect
, 4);
1227 return 0; /* Not a trampoline. */
1231 /* Return non-zero if PC and NAME show that we are in a signal
1235 i386_pc_in_sigtramp (CORE_ADDR pc
, char *name
)
1237 return (name
&& strcmp ("_sigtramp", name
) == 0);
1241 /* We have two flavours of disassembly. The machinery on this page
1242 deals with switching between those. */
1245 gdb_print_insn_i386 (bfd_vma memaddr
, disassemble_info
*info
)
1247 if (disassembly_flavor
== att_flavor
)
1248 return print_insn_i386_att (memaddr
, info
);
1249 else if (disassembly_flavor
== intel_flavor
)
1250 return print_insn_i386_intel (memaddr
, info
);
1251 /* Never reached -- disassembly_flavour is always either att_flavor
1253 internal_error (__FILE__
, __LINE__
, "failed internal consistency check");
1257 /* There are a few i386 architecture variants that differ only
1258 slightly from the generic i386 target. For now, we don't give them
1259 their own source file, but include them here. As a consequence,
1260 they'll always be included. */
1262 /* System V Release 4 (SVR4). */
1265 i386_svr4_pc_in_sigtramp (CORE_ADDR pc
, char *name
)
1267 return (name
&& (strcmp ("_sigreturn", name
) == 0
1268 || strcmp ("_sigacthandler", name
) == 0
1269 || strcmp ("sigvechandler", name
) == 0));
1272 /* Get address of the pushed ucontext (sigcontext) on the stack for
1273 all three variants of SVR4 sigtramps. */
1276 i386_svr4_sigcontext_addr (struct frame_info
*frame
)
1278 int sigcontext_offset
= -1;
1281 find_pc_partial_function (frame
->pc
, &name
, NULL
, NULL
);
1284 if (strcmp (name
, "_sigreturn") == 0)
1285 sigcontext_offset
= 132;
1286 else if (strcmp (name
, "_sigacthandler") == 0)
1287 sigcontext_offset
= 80;
1288 else if (strcmp (name
, "sigvechandler") == 0)
1289 sigcontext_offset
= 120;
1292 gdb_assert (sigcontext_offset
!= -1);
1295 return frame
->next
->frame
+ sigcontext_offset
;
1296 return read_register (SP_REGNUM
) + sigcontext_offset
;
1303 i386_go32_pc_in_sigtramp (CORE_ADDR pc
, char *name
)
1305 /* DJGPP doesn't have any special frames for signal handlers. */
1313 i386_elf_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
1315 /* We typically use stabs-in-ELF with the DWARF register numbering. */
1316 set_gdbarch_stab_reg_to_regnum (gdbarch
, i386_dwarf_reg_to_regnum
);
1319 /* System V Release 4 (SVR4). */
1322 i386_svr4_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
1324 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1326 /* System V Release 4 uses ELF. */
1327 i386_elf_init_abi (info
, gdbarch
);
1329 /* FIXME: kettenis/20020511: Why do we override this function here? */
1330 set_gdbarch_frame_chain_valid (gdbarch
, func_frame_chain_valid
);
1332 set_gdbarch_pc_in_sigtramp (gdbarch
, i386_svr4_pc_in_sigtramp
);
1333 tdep
->sigcontext_addr
= i386_svr4_sigcontext_addr
;
1334 tdep
->sc_pc_offset
= 14 * 4;
1335 tdep
->sc_sp_offset
= 7 * 4;
1337 tdep
->jb_pc_offset
= 20;
1343 i386_go32_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
1345 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1347 set_gdbarch_pc_in_sigtramp (gdbarch
, i386_go32_pc_in_sigtramp
);
1349 tdep
->jb_pc_offset
= 36;
1355 i386_nw_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
1357 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1359 /* FIXME: kettenis/20020511: Why do we override this function here? */
1360 set_gdbarch_frame_chain_valid (gdbarch
, func_frame_chain_valid
);
1362 tdep
->jb_pc_offset
= 24;
1366 static struct gdbarch
*
1367 i386_gdbarch_init (struct gdbarch_info info
, struct gdbarch_list
*arches
)
1369 struct gdbarch_tdep
*tdep
;
1370 struct gdbarch
*gdbarch
;
1371 enum gdb_osabi osabi
= GDB_OSABI_UNKNOWN
;
1373 /* Try to determine the OS ABI of the object we're loading. */
1374 if (info
.abfd
!= NULL
)
1375 osabi
= gdbarch_lookup_osabi (info
.abfd
);
1377 /* Find a candidate among extant architectures. */
1378 for (arches
= gdbarch_list_lookup_by_info (arches
, &info
);
1380 arches
= gdbarch_list_lookup_by_info (arches
->next
, &info
))
1382 /* Make sure the OS ABI selection matches. */
1383 tdep
= gdbarch_tdep (arches
->gdbarch
);
1384 if (tdep
&& tdep
->osabi
== osabi
)
1385 return arches
->gdbarch
;
1388 /* Allocate space for the new architecture. */
1389 tdep
= XMALLOC (struct gdbarch_tdep
);
1390 gdbarch
= gdbarch_alloc (&info
, tdep
);
1392 tdep
->osabi
= osabi
;
1394 /* The i386 default settings don't include the SSE registers.
1395 FIXME: kettenis/20020614: They do include the FPU registers for
1396 now, which probably is not quite right. */
1397 tdep
->num_xmm_regs
= 0;
1399 tdep
->jb_pc_offset
= -1;
1400 tdep
->struct_return
= pcc_struct_return
;
1401 tdep
->sigtramp_start
= 0;
1402 tdep
->sigtramp_end
= 0;
1403 tdep
->sigcontext_addr
= NULL
;
1404 tdep
->sc_pc_offset
= -1;
1405 tdep
->sc_sp_offset
= -1;
1407 /* The format used for `long double' on almost all i386 targets is
1408 the i387 extended floating-point format. In fact, of all targets
1409 in the GCC 2.95 tree, only OSF/1 does it different, and insists
1410 on having a `long double' that's not `long' at all. */
1411 set_gdbarch_long_double_format (gdbarch
, &floatformat_i387_ext
);
1413 /* Although the i386 extended floating-point has only 80 significant
1414 bits, a `long double' actually takes up 96, probably to enforce
1416 set_gdbarch_long_double_bit (gdbarch
, 96);
1418 /* NOTE: tm-i386aix.h, tm-i386bsd.h, tm-i386os9k.h, tm-ptx.h,
1419 tm-symmetry.h currently override this. Sigh. */
1420 set_gdbarch_num_regs (gdbarch
, I386_NUM_GREGS
+ I386_NUM_FREGS
);
1422 set_gdbarch_sp_regnum (gdbarch
, 4);
1423 set_gdbarch_fp_regnum (gdbarch
, 5);
1424 set_gdbarch_pc_regnum (gdbarch
, 8);
1425 set_gdbarch_ps_regnum (gdbarch
, 9);
1426 set_gdbarch_fp0_regnum (gdbarch
, 16);
1428 /* Use the "default" register numbering scheme for stabs and COFF. */
1429 set_gdbarch_stab_reg_to_regnum (gdbarch
, i386_stab_reg_to_regnum
);
1430 set_gdbarch_sdb_reg_to_regnum (gdbarch
, i386_stab_reg_to_regnum
);
1432 /* Use the DWARF register numbering scheme for DWARF and DWARF 2. */
1433 set_gdbarch_dwarf_reg_to_regnum (gdbarch
, i386_dwarf_reg_to_regnum
);
1434 set_gdbarch_dwarf2_reg_to_regnum (gdbarch
, i386_dwarf_reg_to_regnum
);
1436 /* We don't define ECOFF_REG_TO_REGNUM, since ECOFF doesn't seem to
1437 be in use on any of the supported i386 targets. */
1439 set_gdbarch_register_name (gdbarch
, i386_register_name
);
1440 set_gdbarch_register_size (gdbarch
, 4);
1441 set_gdbarch_register_bytes (gdbarch
, I386_SIZEOF_GREGS
+ I386_SIZEOF_FREGS
);
1442 set_gdbarch_register_byte (gdbarch
, i386_register_byte
);
1443 set_gdbarch_register_raw_size (gdbarch
, i386_register_raw_size
);
1444 set_gdbarch_max_register_raw_size (gdbarch
, I386_MAX_REGISTER_SIZE
);
1445 set_gdbarch_max_register_virtual_size (gdbarch
, I386_MAX_REGISTER_SIZE
);
1446 set_gdbarch_register_virtual_type (gdbarch
, i386_register_virtual_type
);
1448 set_gdbarch_get_longjmp_target (gdbarch
, i386_get_longjmp_target
);
1450 set_gdbarch_use_generic_dummy_frames (gdbarch
, 1);
1452 /* Call dummy code. */
1453 set_gdbarch_call_dummy_location (gdbarch
, AT_ENTRY_POINT
);
1454 set_gdbarch_call_dummy_address (gdbarch
, entry_point_address
);
1455 set_gdbarch_call_dummy_start_offset (gdbarch
, 0);
1456 set_gdbarch_call_dummy_breakpoint_offset (gdbarch
, 0);
1457 set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch
, 1);
1458 set_gdbarch_call_dummy_length (gdbarch
, 0);
1459 set_gdbarch_call_dummy_p (gdbarch
, 1);
1460 set_gdbarch_call_dummy_words (gdbarch
, NULL
);
1461 set_gdbarch_sizeof_call_dummy_words (gdbarch
, 0);
1462 set_gdbarch_call_dummy_stack_adjust_p (gdbarch
, 0);
1463 set_gdbarch_fix_call_dummy (gdbarch
, generic_fix_call_dummy
);
1465 set_gdbarch_register_convertible (gdbarch
, i386_register_convertible
);
1466 set_gdbarch_register_convert_to_virtual (gdbarch
,
1467 i386_register_convert_to_virtual
);
1468 set_gdbarch_register_convert_to_raw (gdbarch
, i386_register_convert_to_raw
);
1470 set_gdbarch_get_saved_register (gdbarch
, generic_get_saved_register
);
1471 set_gdbarch_push_arguments (gdbarch
, i386_push_arguments
);
1473 set_gdbarch_pc_in_call_dummy (gdbarch
, pc_in_call_dummy_at_entry_point
);
1475 /* "An argument's size is increased, if necessary, to make it a
1476 multiple of [32-bit] words. This may require tail padding,
1477 depending on the size of the argument" -- from the x86 ABI. */
1478 set_gdbarch_parm_boundary (gdbarch
, 32);
1480 set_gdbarch_extract_return_value (gdbarch
, i386_extract_return_value
);
1481 set_gdbarch_push_arguments (gdbarch
, i386_push_arguments
);
1482 set_gdbarch_push_dummy_frame (gdbarch
, generic_push_dummy_frame
);
1483 set_gdbarch_push_return_address (gdbarch
, i386_push_return_address
);
1484 set_gdbarch_pop_frame (gdbarch
, i386_pop_frame
);
1485 set_gdbarch_store_struct_return (gdbarch
, i386_store_struct_return
);
1486 set_gdbarch_store_return_value (gdbarch
, i386_store_return_value
);
1487 set_gdbarch_extract_struct_value_address (gdbarch
,
1488 i386_extract_struct_value_address
);
1489 set_gdbarch_use_struct_convention (gdbarch
, i386_use_struct_convention
);
1491 set_gdbarch_frame_init_saved_regs (gdbarch
, i386_frame_init_saved_regs
);
1492 set_gdbarch_skip_prologue (gdbarch
, i386_skip_prologue
);
1494 /* Stack grows downward. */
1495 set_gdbarch_inner_than (gdbarch
, core_addr_lessthan
);
1497 set_gdbarch_breakpoint_from_pc (gdbarch
, i386_breakpoint_from_pc
);
1498 set_gdbarch_decr_pc_after_break (gdbarch
, 1);
1499 set_gdbarch_function_start_offset (gdbarch
, 0);
1501 /* The following redefines make backtracing through sigtramp work.
1502 They manufacture a fake sigtramp frame and obtain the saved pc in
1503 sigtramp from the sigcontext structure which is pushed by the
1504 kernel on the user stack, along with a pointer to it. */
1506 set_gdbarch_frame_args_skip (gdbarch
, 8);
1507 set_gdbarch_frameless_function_invocation (gdbarch
,
1508 i386_frameless_function_invocation
);
1509 set_gdbarch_frame_chain (gdbarch
, i386_frame_chain
);
1510 set_gdbarch_frame_chain_valid (gdbarch
, generic_file_frame_chain_valid
);
1511 set_gdbarch_frame_saved_pc (gdbarch
, i386_frame_saved_pc
);
1512 set_gdbarch_frame_args_address (gdbarch
, default_frame_address
);
1513 set_gdbarch_frame_locals_address (gdbarch
, default_frame_address
);
1514 set_gdbarch_saved_pc_after_call (gdbarch
, i386_saved_pc_after_call
);
1515 set_gdbarch_frame_num_args (gdbarch
, i386_frame_num_args
);
1516 set_gdbarch_pc_in_sigtramp (gdbarch
, i386_pc_in_sigtramp
);
1518 /* Hook in ABI-specific overrides, if they have been registered. */
1519 gdbarch_init_osabi (info
, gdbarch
, osabi
);
1524 static enum gdb_osabi
1525 i386_coff_osabi_sniffer (bfd
*abfd
)
1527 if (strcmp (bfd_get_target (abfd
), "coff-go32-exe") == 0
1528 || strcmp (bfd_get_target (abfd
), "coff-go32") == 0)
1529 return GDB_OSABI_GO32
;
1531 return GDB_OSABI_UNKNOWN
;
1534 static enum gdb_osabi
1535 i386_nlm_osabi_sniffer (bfd
*abfd
)
1537 return GDB_OSABI_NETWARE
;
1541 /* Provide a prototype to silence -Wmissing-prototypes. */
1542 void _initialize_i386_tdep (void);
1545 _initialize_i386_tdep (void)
1547 register_gdbarch_init (bfd_arch_i386
, i386_gdbarch_init
);
1549 /* Initialize the table saying where each register starts in the
1555 for (i
= 0; i
< I386_SSE_NUM_REGS
; i
++)
1557 i386_register_offset
[i
] = offset
;
1558 offset
+= i386_register_size
[i
];
1562 tm_print_insn
= gdb_print_insn_i386
;
1563 tm_print_insn_info
.mach
= bfd_lookup_arch (bfd_arch_i386
, 0)->mach
;
1565 /* Add the variable that controls the disassembly flavor. */
1567 struct cmd_list_element
*new_cmd
;
1569 new_cmd
= add_set_enum_cmd ("disassembly-flavor", no_class
,
1571 &disassembly_flavor
,
1573 Set the disassembly flavor, the valid values are \"att\" and \"intel\", \
1574 and the default value is \"att\".",
1576 add_show_from_set (new_cmd
, &showlist
);
1579 /* Add the variable that controls the convention for returning
1582 struct cmd_list_element
*new_cmd
;
1584 new_cmd
= add_set_enum_cmd ("struct-convention", no_class
,
1586 &struct_convention
, "\
1587 Set the convention for returning small structs, valid values \
1588 are \"default\", \"pcc\" and \"reg\", and the default value is \"default\".",
1590 add_show_from_set (new_cmd
, &showlist
);
1593 gdbarch_register_osabi_sniffer (bfd_arch_i386
, bfd_target_coff_flavour
,
1594 i386_coff_osabi_sniffer
);
1595 gdbarch_register_osabi_sniffer (bfd_arch_i386
, bfd_target_nlm_flavour
,
1596 i386_nlm_osabi_sniffer
);
1598 gdbarch_register_osabi (bfd_arch_i386
, GDB_OSABI_SVR4
,
1599 i386_svr4_init_abi
);
1600 gdbarch_register_osabi (bfd_arch_i386
, GDB_OSABI_GO32
,
1601 i386_go32_init_abi
);
1602 gdbarch_register_osabi (bfd_arch_i386
, GDB_OSABI_NETWARE
,