* s390-tdep.c (s390_get_frame_info): Give orig_sp a reasonable
[deliverable/binutils-gdb.git] / gdb / s390-tdep.c
CommitLineData
5769d3cd
AC
1/* Target-dependent code for GDB, the GNU debugger.
2 Copyright 2001 Free Software Foundation, Inc.
3 Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
4 for IBM Deutschland Entwicklung GmbH, IBM Corporation.
5
6 This file is part of GDB.
7
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.
12
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.
17
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, Boston, MA
21 02111-1307, USA. */
22
23#define S390_TDEP /* for special macros in tm-s390.h */
24#include <defs.h>
25#include "arch-utils.h"
26#include "frame.h"
27#include "inferior.h"
28#include "symtab.h"
29#include "target.h"
30#include "gdbcore.h"
31#include "gdbcmd.h"
32#include "symfile.h"
33#include "objfiles.h"
34#include "tm.h"
35#include "../bfd/bfd.h"
36#include "floatformat.h"
37#include "regcache.h"
fd0407d6 38#include "value.h"
78f8b424 39#include "gdb_assert.h"
5769d3cd
AC
40
41
42
60e6cc42 43
5769d3cd 44/* Number of bytes of storage in the actual machine representation
23b7362f 45 for register N. */
5769d3cd
AC
46int
47s390_register_raw_size (int reg_nr)
48{
23b7362f
JB
49 if (S390_FP0_REGNUM <= reg_nr
50 && reg_nr < S390_FP0_REGNUM + S390_NUM_FPRS)
51 return S390_FPR_SIZE;
52 else
53 return 4;
5769d3cd
AC
54}
55
56int
57s390x_register_raw_size (int reg_nr)
58{
59 return (reg_nr == S390_FPC_REGNUM)
60 || (reg_nr >= S390_FIRST_ACR && reg_nr <= S390_LAST_ACR) ? 4 : 8;
61}
62
63int
64s390_cannot_fetch_register (int regno)
65{
66 return (regno >= S390_FIRST_CR && regno < (S390_FIRST_CR + 9)) ||
67 (regno >= (S390_FIRST_CR + 12) && regno <= S390_LAST_CR);
68}
69
70int
71s390_register_byte (int reg_nr)
72{
73 if (reg_nr <= S390_GP_LAST_REGNUM)
74 return reg_nr * S390_GPR_SIZE;
75 if (reg_nr <= S390_LAST_ACR)
76 return S390_ACR0_OFFSET + (((reg_nr) - S390_FIRST_ACR) * S390_ACR_SIZE);
77 if (reg_nr <= S390_LAST_CR)
78 return S390_CR0_OFFSET + (((reg_nr) - S390_FIRST_CR) * S390_CR_SIZE);
79 if (reg_nr == S390_FPC_REGNUM)
80 return S390_FPC_OFFSET;
81 else
82 return S390_FP0_OFFSET + (((reg_nr) - S390_FP0_REGNUM) * S390_FPR_SIZE);
83}
84
85#ifndef GDBSERVER
86#define S390_MAX_INSTR_SIZE (6)
87#define S390_SYSCALL_OPCODE (0x0a)
88#define S390_SYSCALL_SIZE (2)
89#define S390_SIGCONTEXT_SREGS_OFFSET (8)
90#define S390X_SIGCONTEXT_SREGS_OFFSET (8)
91#define S390_SIGREGS_FP0_OFFSET (144)
92#define S390X_SIGREGS_FP0_OFFSET (216)
93#define S390_UC_MCONTEXT_OFFSET (256)
94#define S390X_UC_MCONTEXT_OFFSET (344)
95#define S390_STACK_FRAME_OVERHEAD (GDB_TARGET_IS_ESAME ? 160:96)
96#define S390_SIGNAL_FRAMESIZE (GDB_TARGET_IS_ESAME ? 160:96)
97#define s390_NR_sigreturn 119
98#define s390_NR_rt_sigreturn 173
99
100
101
102struct frame_extra_info
103{
104 int initialised;
105 int good_prologue;
106 CORE_ADDR function_start;
107 CORE_ADDR skip_prologue_function_start;
108 CORE_ADDR saved_pc_valid;
109 CORE_ADDR saved_pc;
110 CORE_ADDR sig_fixed_saved_pc_valid;
111 CORE_ADDR sig_fixed_saved_pc;
112 CORE_ADDR frame_pointer_saved_pc; /* frame pointer needed for alloca */
113 CORE_ADDR stack_bought; /* amount we decrement the stack pointer by */
114 CORE_ADDR sigcontext;
115};
116
117
118static CORE_ADDR s390_frame_saved_pc_nofix (struct frame_info *fi);
119
120int
121s390_readinstruction (bfd_byte instr[], CORE_ADDR at,
122 struct disassemble_info *info)
123{
124 int instrlen;
125
126 static int s390_instrlen[] = {
127 2,
128 4,
129 4,
130 6
131 };
132 if ((*info->read_memory_func) (at, &instr[0], 2, info))
133 return -1;
134 instrlen = s390_instrlen[instr[0] >> 6];
c5e243bb
JB
135 if (instrlen > 2)
136 {
137 if ((*info->read_memory_func) (at + 2, &instr[2], instrlen - 2, info))
138 return -1;
139 }
5769d3cd
AC
140 return instrlen;
141}
142
143static void
144s390_memset_extra_info (struct frame_extra_info *fextra_info)
145{
146 memset (fextra_info, 0, sizeof (struct frame_extra_info));
147}
148
149
150
151char *
152s390_register_name (int reg_nr)
153{
154 static char *register_names[] = {
155 "pswm", "pswa",
4ed90530
JB
156 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
157 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
5769d3cd
AC
158 "acr0", "acr1", "acr2", "acr3", "acr4", "acr5", "acr6", "acr7",
159 "acr8", "acr9", "acr10", "acr11", "acr12", "acr13", "acr14", "acr15",
160 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",
161 "cr8", "cr9", "cr10", "cr11", "cr12", "cr13", "cr14", "cr15",
162 "fpc",
4ed90530
JB
163 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
164 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"
5769d3cd
AC
165 };
166
b09677dc
JB
167 if (reg_nr <= S390_LAST_REGNUM)
168 return register_names[reg_nr];
169 else
5769d3cd 170 return NULL;
5769d3cd
AC
171}
172
173
174
175
176int
177s390_stab_reg_to_regnum (int regno)
178{
179 return regno >= 64 ? S390_PSWM_REGNUM - 64 :
180 regno >= 48 ? S390_FIRST_ACR - 48 :
181 regno >= 32 ? S390_FIRST_CR - 32 :
182 regno <= 15 ? (regno + 2) :
183 S390_FP0_REGNUM + ((regno - 16) & 8) + (((regno - 16) & 3) << 1) +
184 (((regno - 16) & 4) >> 2);
185}
186
187
12bffad7
JB
188/* Return true if REGIDX is the number of a register used to pass
189 arguments, false otherwise. */
190static int
191is_arg_reg (int regidx)
192{
193 return 2 <= regidx && regidx <= 6;
194}
195
5769d3cd
AC
196
197/* s390_get_frame_info based on Hartmuts
198 prologue definition in
199 gcc-2.8.1/config/l390/linux.c
200
201 It reads one instruction at a time & based on whether
202 it looks like prologue code or not it makes a decision on
203 whether the prologue is over, there are various state machines
204 in the code to determine if the prologue code is possilby valid.
205
206 This is done to hopefully allow the code survive minor revs of
207 calling conventions.
208
209 */
210
211int
212s390_get_frame_info (CORE_ADDR pc, struct frame_extra_info *fextra_info,
213 struct frame_info *fi, int init_extra_info)
214{
215#define CONST_POOL_REGIDX 13
216#define GOT_REGIDX 12
217 bfd_byte instr[S390_MAX_INSTR_SIZE];
218 CORE_ADDR test_pc = pc, test_pc2;
219 CORE_ADDR orig_sp = 0, save_reg_addr = 0, *saved_regs = NULL;
220 int valid_prologue, good_prologue = 0;
221 int gprs_saved[S390_NUM_GPRS];
222 int fprs_saved[S390_NUM_FPRS];
223 int regidx, instrlen;
6df29de2 224 int const_pool_state;
7286245e 225 int varargs_state;
5769d3cd 226 int loop_cnt, gdb_gpr_store, gdb_fpr_store;
5769d3cd
AC
227 int offset, expected_offset;
228 int err = 0;
229 disassemble_info info;
8ac0e65a 230
7286245e
JB
231 /* Have we seen an instruction initializing the frame pointer yet?
232 If we've seen an `lr %r11, %r15', then frame_pointer_found is
233 non-zero, and frame_pointer_regidx == 11. Otherwise,
234 frame_pointer_found is zero and frame_pointer_regidx is 15,
235 indicating that we're using the stack pointer as our frame
236 pointer. */
237 int frame_pointer_found = 0;
238 int frame_pointer_regidx = 0xf;
239
6df29de2
JB
240 /* What we've seen so far regarding saving the back chain link:
241 0 -- nothing yet; sp still has the same value it had at the entry
242 point. Since not all functions allocate frames, this is a
243 valid state for the prologue to finish in.
244 1 -- We've saved the original sp in some register other than the
245 frame pointer (hard-coded to be %r11, yuck).
246 save_link_regidx is the register we saved it in.
247 2 -- We've seen the initial `bras' instruction of the sequence for
248 reserving more than 32k of stack:
249 bras %rX, .+8
250 .long N
251 s %r15, 0(%rX)
252 where %rX is not the constant pool register.
253 subtract_sp_regidx is %rX, and fextra_info->stack_bought is N.
254 3 -- We've reserved space for a new stack frame. This means we
255 either saw a simple `ahi %r15,-N' in state 1, or the final
256 `s %r15, ...' in state 2.
257 4 -- The frame and link are now fully initialized. We've
258 reserved space for the new stack frame, and stored the old
259 stack pointer captured in the back chain pointer field. */
7286245e 260 int save_link_state = 0;
6df29de2
JB
261 int save_link_regidx, subtract_sp_regidx;
262
8ac0e65a
JB
263 /* What we've seen so far regarding r12 --- the GOT (Global Offset
264 Table) pointer. We expect to see `l %r12, N(%r13)', which loads
265 r12 with the offset from the constant pool to the GOT, and then
266 an `ar %r12, %r13', which adds the constant pool address,
267 yielding the GOT's address. Here's what got_state means:
268 0 -- seen nothing
269 1 -- seen `l %r12, N(%r13)', but no `ar'
270 2 -- seen load and add, so GOT pointer is totally initialized
271 When got_state is 1, then got_load_addr is the address of the
272 load instruction, and got_load_len is the length of that
273 instruction. */
7286245e 274 int got_state= 0;
64f9bb98 275 CORE_ADDR got_load_addr = 0, got_load_len = 0;
8ac0e65a 276
7286245e
JB
277 const_pool_state = varargs_state = 0;
278
5769d3cd
AC
279 memset (gprs_saved, 0, sizeof (gprs_saved));
280 memset (fprs_saved, 0, sizeof (fprs_saved));
281 info.read_memory_func = dis_asm_read_memory;
282
283 save_link_regidx = subtract_sp_regidx = 0;
284 if (fextra_info)
285 {
286 if (fi && fi->frame)
287 {
76cc2cf0 288 orig_sp = fi->frame;
386e4208 289 if (! init_extra_info && fextra_info->initialised)
76cc2cf0 290 orig_sp += fextra_info->stack_bought;
5769d3cd
AC
291 saved_regs = fi->saved_regs;
292 }
293 if (init_extra_info || !fextra_info->initialised)
294 {
295 s390_memset_extra_info (fextra_info);
296 fextra_info->function_start = pc;
297 fextra_info->initialised = 1;
298 }
299 }
300 instrlen = 0;
301 do
302 {
303 valid_prologue = 0;
304 test_pc += instrlen;
305 /* add the previous instruction len */
306 instrlen = s390_readinstruction (instr, test_pc, &info);
307 if (instrlen < 0)
308 {
309 good_prologue = 0;
310 err = -1;
311 break;
312 }
313 /* We probably are in a glibc syscall */
314 if (instr[0] == S390_SYSCALL_OPCODE && test_pc == pc)
315 {
316 good_prologue = 1;
317 if (saved_regs && fextra_info && fi->next && fi->next->extra_info
318 && fi->next->extra_info->sigcontext)
319 {
320 /* We are backtracing from a signal handler */
321 save_reg_addr = fi->next->extra_info->sigcontext +
322 REGISTER_BYTE (S390_GP0_REGNUM);
323 for (regidx = 0; regidx < S390_NUM_GPRS; regidx++)
324 {
325 saved_regs[S390_GP0_REGNUM + regidx] = save_reg_addr;
326 save_reg_addr += S390_GPR_SIZE;
327 }
328 save_reg_addr = fi->next->extra_info->sigcontext +
329 (GDB_TARGET_IS_ESAME ? S390X_SIGREGS_FP0_OFFSET :
330 S390_SIGREGS_FP0_OFFSET);
331 for (regidx = 0; regidx < S390_NUM_FPRS; regidx++)
332 {
333 saved_regs[S390_FP0_REGNUM + regidx] = save_reg_addr;
334 save_reg_addr += S390_FPR_SIZE;
335 }
336 }
337 break;
338 }
339 if (save_link_state == 0)
340 {
341 /* check for a stack relative STMG or STM */
342 if (((GDB_TARGET_IS_ESAME &&
343 ((instr[0] == 0xeb) && (instr[5] == 0x24))) ||
344 (instr[0] == 0x90)) && ((instr[2] >> 4) == 0xf))
345 {
346 regidx = (instr[1] >> 4);
347 if (regidx < 6)
348 varargs_state = 1;
349 offset = ((instr[2] & 0xf) << 8) + instr[3];
350 expected_offset =
351 S390_GPR6_STACK_OFFSET + (S390_GPR_SIZE * (regidx - 6));
352 if (offset != expected_offset)
353 {
354 good_prologue = 0;
355 break;
356 }
357 if (saved_regs)
358 save_reg_addr = orig_sp + offset;
359 for (; regidx <= (instr[1] & 0xf); regidx++)
360 {
361 if (gprs_saved[regidx])
362 {
363 good_prologue = 0;
364 break;
365 }
366 good_prologue = 1;
367 gprs_saved[regidx] = 1;
368 if (saved_regs)
369 {
370 saved_regs[S390_GP0_REGNUM + regidx] = save_reg_addr;
371 save_reg_addr += S390_GPR_SIZE;
372 }
373 }
374 valid_prologue = 1;
375 continue;
376 }
377 }
378 /* check for a stack relative STG or ST */
379 if ((save_link_state == 0 || save_link_state == 3) &&
380 ((GDB_TARGET_IS_ESAME &&
381 ((instr[0] == 0xe3) && (instr[5] == 0x24))) ||
382 (instr[0] == 0x50)) && ((instr[2] >> 4) == 0xf))
383 {
384 regidx = instr[1] >> 4;
385 offset = ((instr[2] & 0xf) << 8) + instr[3];
386 if (offset == 0)
387 {
388 if (save_link_state == 3 && regidx == save_link_regidx)
389 {
390 save_link_state = 4;
391 valid_prologue = 1;
392 continue;
393 }
394 else
395 break;
396 }
397 if (regidx < 6)
398 varargs_state = 1;
399 expected_offset =
400 S390_GPR6_STACK_OFFSET + (S390_GPR_SIZE * (regidx - 6));
401 if (offset != expected_offset)
402 {
403 good_prologue = 0;
404 break;
405 }
406 if (gprs_saved[regidx])
407 {
408 good_prologue = 0;
409 break;
410 }
411 good_prologue = 1;
412 gprs_saved[regidx] = 1;
413 if (saved_regs)
414 {
415 save_reg_addr = orig_sp + offset;
416 saved_regs[S390_GP0_REGNUM + regidx] = save_reg_addr;
417 }
418 valid_prologue = 1;
419 continue;
420 }
421
12bffad7 422 /* Check for an fp-relative STG, ST, or STM. This is probably
7666f43c
JB
423 spilling an argument from a register out into a stack slot.
424 This could be a user instruction, but if we haven't included
425 any other suspicious instructions in the prologue, this
426 could only be an initializing store, which isn't too bad to
427 skip. The consequences of not including arg-to-stack spills
428 are more serious, though --- you don't see the proper values
429 of the arguments. */
430 if ((save_link_state == 3 || save_link_state == 4)
12bffad7
JB
431 && ((instr[0] == 0x50 /* st %rA, D(%rX,%rB) */
432 && (instr[1] & 0xf) == 0 /* %rX is zero, no index reg */
433 && is_arg_reg ((instr[1] >> 4) & 0xf)
434 && ((instr[2] >> 4) & 0xf) == frame_pointer_regidx)
435 || (instr[0] == 0x90 /* stm %rA, %rB, D(%rC) */
436 && is_arg_reg ((instr[1] >> 4) & 0xf)
437 && is_arg_reg (instr[1] & 0xf)
438 && ((instr[2] >> 4) & 0xf) == frame_pointer_regidx)))
7666f43c
JB
439 {
440 valid_prologue = 1;
441 continue;
442 }
443
5769d3cd
AC
444 /* check for STD */
445 if (instr[0] == 0x60 && (instr[2] >> 4) == 0xf)
446 {
447 regidx = instr[1] >> 4;
448 if (regidx == 0 || regidx == 2)
449 varargs_state = 1;
450 if (fprs_saved[regidx])
451 {
452 good_prologue = 0;
453 break;
454 }
455 fprs_saved[regidx] = 1;
456 if (saved_regs)
457 {
458 save_reg_addr = orig_sp + (((instr[2] & 0xf) << 8) + instr[3]);
459 saved_regs[S390_FP0_REGNUM + regidx] = save_reg_addr;
460 }
461 valid_prologue = 1;
462 continue;
463 }
464
465
466 if (const_pool_state == 0)
467 {
468
469 if (GDB_TARGET_IS_ESAME)
470 {
471 /* Check for larl CONST_POOL_REGIDX,offset on ESAME */
472 if ((instr[0] == 0xc0)
473 && (instr[1] == (CONST_POOL_REGIDX << 4)))
474 {
475 const_pool_state = 2;
476 valid_prologue = 1;
477 continue;
478 }
479 }
480 else
481 {
482 /* Check for BASR gpr13,gpr0 used to load constant pool pointer to r13 in old compiler */
483 if (instr[0] == 0xd && (instr[1] & 0xf) == 0
484 && ((instr[1] >> 4) == CONST_POOL_REGIDX))
485 {
486 const_pool_state = 1;
487 valid_prologue = 1;
488 continue;
489 }
490 }
491 /* Check for new fangled bras %r13,newpc to load new constant pool */
492 /* embedded in code, older pre abi compilers also emitted this stuff. */
493 if ((instr[0] == 0xa7) && ((instr[1] & 0xf) == 0x5) &&
494 ((instr[1] >> 4) == CONST_POOL_REGIDX)
495 && ((instr[2] & 0x80) == 0))
496 {
497 const_pool_state = 2;
498 test_pc +=
499 (((((instr[2] & 0xf) << 8) + instr[3]) << 1) - instrlen);
500 valid_prologue = 1;
501 continue;
502 }
503 }
504 /* Check for AGHI or AHI CONST_POOL_REGIDX,val */
505 if (const_pool_state == 1 && (instr[0] == 0xa7) &&
506 ((GDB_TARGET_IS_ESAME &&
507 (instr[1] == ((CONST_POOL_REGIDX << 4) | 0xb))) ||
508 (instr[1] == ((CONST_POOL_REGIDX << 4) | 0xa))))
509 {
510 const_pool_state = 2;
511 valid_prologue = 1;
512 continue;
513 }
514 /* Check for LGR or LR gprx,15 */
515 if ((GDB_TARGET_IS_ESAME &&
516 instr[0] == 0xb9 && instr[1] == 0x04 && (instr[3] & 0xf) == 0xf) ||
517 (instr[0] == 0x18 && (instr[1] & 0xf) == 0xf))
518 {
519 if (GDB_TARGET_IS_ESAME)
520 regidx = instr[3] >> 4;
521 else
522 regidx = instr[1] >> 4;
523 if (save_link_state == 0 && regidx != 0xb)
524 {
525 /* Almost defintely code for
526 decrementing the stack pointer
527 ( i.e. a non leaf function
528 or else leaf with locals ) */
529 save_link_regidx = regidx;
530 save_link_state = 1;
531 valid_prologue = 1;
532 continue;
533 }
534 /* We use this frame pointer for alloca
535 unfortunately we need to assume its gpr11
536 otherwise we would need a smarter prologue
537 walker. */
538 if (!frame_pointer_found && regidx == 0xb)
539 {
540 frame_pointer_regidx = 0xb;
541 frame_pointer_found = 1;
542 if (fextra_info)
543 fextra_info->frame_pointer_saved_pc = test_pc;
544 valid_prologue = 1;
545 continue;
546 }
547 }
548 /* Check for AHI or AGHI gpr15,val */
549 if (save_link_state == 1 && (instr[0] == 0xa7) &&
550 ((GDB_TARGET_IS_ESAME && (instr[1] == 0xfb)) || (instr[1] == 0xfa)))
551 {
552 if (fextra_info)
553 fextra_info->stack_bought =
554 -extract_signed_integer (&instr[2], 2);
555 save_link_state = 3;
556 valid_prologue = 1;
557 continue;
558 }
559 /* Alternatively check for the complex construction for
560 buying more than 32k of stack
561 BRAS gprx,.+8
6df29de2
JB
562 long val
563 s %r15,0(%gprx) gprx currently r1 */
5769d3cd
AC
564 if ((save_link_state == 1) && (instr[0] == 0xa7)
565 && ((instr[1] & 0xf) == 0x5) && (instr[2] == 0)
566 && (instr[3] == 0x4) && ((instr[1] >> 4) != CONST_POOL_REGIDX))
567 {
568 subtract_sp_regidx = instr[1] >> 4;
569 save_link_state = 2;
570 if (fextra_info)
571 target_read_memory (test_pc + instrlen,
572 (char *) &fextra_info->stack_bought,
573 sizeof (fextra_info->stack_bought));
574 test_pc += 4;
575 valid_prologue = 1;
576 continue;
577 }
578 if (save_link_state == 2 && instr[0] == 0x5b
579 && instr[1] == 0xf0 &&
580 instr[2] == (subtract_sp_regidx << 4) && instr[3] == 0)
581 {
582 save_link_state = 3;
583 valid_prologue = 1;
584 continue;
585 }
586 /* check for LA gprx,offset(15) used for varargs */
587 if ((instr[0] == 0x41) && ((instr[2] >> 4) == 0xf) &&
588 ((instr[1] & 0xf) == 0))
589 {
590 /* some code uses gpr7 to point to outgoing args */
591 if (((instr[1] >> 4) == 7) && (save_link_state == 0) &&
592 ((instr[2] & 0xf) == 0)
593 && (instr[3] == S390_STACK_FRAME_OVERHEAD))
594 {
595 valid_prologue = 1;
596 continue;
597 }
598 if (varargs_state == 1)
599 {
600 varargs_state = 2;
601 valid_prologue = 1;
602 continue;
603 }
604 }
605 /* Check for a GOT load */
606
607 if (GDB_TARGET_IS_ESAME)
608 {
609 /* Check for larl GOT_REGIDX, on ESAME */
610 if ((got_state == 0) && (instr[0] == 0xc0)
611 && (instr[1] == (GOT_REGIDX << 4)))
612 {
613 got_state = 2;
614 valid_prologue = 1;
615 continue;
616 }
617 }
618 else
619 {
620 /* check for l GOT_REGIDX,x(CONST_POOL_REGIDX) */
621 if (got_state == 0 && const_pool_state == 2 && instr[0] == 0x58
622 && (instr[2] == (CONST_POOL_REGIDX << 4))
623 && ((instr[1] >> 4) == GOT_REGIDX))
624 {
8ac0e65a
JB
625 got_state = 1;
626 got_load_addr = test_pc;
627 got_load_len = instrlen;
5769d3cd
AC
628 valid_prologue = 1;
629 continue;
630 }
631 /* Check for subsequent ar got_regidx,basr_regidx */
632 if (got_state == 1 && instr[0] == 0x1a &&
633 instr[1] == ((GOT_REGIDX << 4) | CONST_POOL_REGIDX))
634 {
635 got_state = 2;
636 valid_prologue = 1;
637 continue;
638 }
639 }
640 }
641 while (valid_prologue && good_prologue);
642 if (good_prologue)
643 {
8ac0e65a
JB
644 /* If this function doesn't reference the global offset table,
645 then the compiler may use r12 for other things. If the last
646 instruction we saw was a load of r12 from the constant pool,
647 with no subsequent add to make the address PC-relative, then
648 the load was probably a genuine body instruction; don't treat
649 it as part of the prologue. */
650 if (got_state == 1
651 && got_load_addr + got_load_len == test_pc)
652 {
653 test_pc = got_load_addr;
654 instrlen = got_load_len;
655 }
656
657 good_prologue = (((const_pool_state == 0) || (const_pool_state == 2)) &&
5769d3cd
AC
658 ((save_link_state == 0) || (save_link_state == 4)) &&
659 ((varargs_state == 0) || (varargs_state == 2)));
660 }
661 if (fextra_info)
662 {
663 fextra_info->good_prologue = good_prologue;
664 fextra_info->skip_prologue_function_start =
665 (good_prologue ? test_pc : pc);
666 }
09025237
JB
667 if (saved_regs)
668 /* The SP's element of the saved_regs array holds the old SP,
669 not the address at which it is saved. */
670 saved_regs[S390_SP_REGNUM] = orig_sp;
5769d3cd
AC
671 return err;
672}
673
674
675int
676s390_check_function_end (CORE_ADDR pc)
677{
678 bfd_byte instr[S390_MAX_INSTR_SIZE];
679 disassemble_info info;
680 int regidx, instrlen;
681
682 info.read_memory_func = dis_asm_read_memory;
683 instrlen = s390_readinstruction (instr, pc, &info);
684 if (instrlen < 0)
685 return -1;
686 /* check for BR */
687 if (instrlen != 2 || instr[0] != 07 || (instr[1] >> 4) != 0xf)
688 return 0;
689 regidx = instr[1] & 0xf;
690 /* Check for LMG or LG */
691 instrlen =
692 s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 6 : 4), &info);
693 if (instrlen < 0)
694 return -1;
695 if (GDB_TARGET_IS_ESAME)
696 {
697
698 if (instrlen != 6 || instr[0] != 0xeb || instr[5] != 0x4)
699 return 0;
700 }
701 else if (instrlen != 4 || instr[0] != 0x98)
702 {
703 return 0;
704 }
705 if ((instr[2] >> 4) != 0xf)
706 return 0;
707 if (regidx == 14)
708 return 1;
709 instrlen = s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 12 : 8),
710 &info);
711 if (instrlen < 0)
712 return -1;
713 if (GDB_TARGET_IS_ESAME)
714 {
715 /* Check for LG */
716 if (instrlen != 6 || instr[0] != 0xe3 || instr[5] != 0x4)
717 return 0;
718 }
719 else
720 {
721 /* Check for L */
722 if (instrlen != 4 || instr[0] != 0x58)
723 return 0;
724 }
725 if (instr[2] >> 4 != 0xf)
726 return 0;
727 if (instr[1] >> 4 != regidx)
728 return 0;
729 return 1;
730}
731
732static CORE_ADDR
733s390_sniff_pc_function_start (CORE_ADDR pc, struct frame_info *fi)
734{
735 CORE_ADDR function_start, test_function_start;
736 int loop_cnt, err, function_end;
737 struct frame_extra_info fextra_info;
738 function_start = get_pc_function_start (pc);
739
740 if (function_start == 0)
741 {
742 test_function_start = pc;
743 if (test_function_start & 1)
744 return 0; /* This has to be bogus */
745 loop_cnt = 0;
746 do
747 {
748
749 err =
750 s390_get_frame_info (test_function_start, &fextra_info, fi, 1);
751 loop_cnt++;
752 test_function_start -= 2;
753 function_end = s390_check_function_end (test_function_start);
754 }
755 while (!(function_end == 1 || err || loop_cnt >= 4096 ||
756 (fextra_info.good_prologue)));
757 if (fextra_info.good_prologue)
758 function_start = fextra_info.function_start;
759 else if (function_end == 1)
760 function_start = test_function_start;
761 }
762 return function_start;
763}
764
765
766
767CORE_ADDR
768s390_function_start (struct frame_info *fi)
769{
770 CORE_ADDR function_start = 0;
771
772 if (fi->extra_info && fi->extra_info->initialised)
773 function_start = fi->extra_info->function_start;
774 else if (fi->pc)
775 function_start = get_pc_function_start (fi->pc);
776 return function_start;
777}
778
779
780
781
782int
783s390_frameless_function_invocation (struct frame_info *fi)
784{
785 struct frame_extra_info fextra_info, *fextra_info_ptr;
786 int frameless = 0;
787
788 if (fi->next == NULL) /* no may be frameless */
789 {
790 if (fi->extra_info)
791 fextra_info_ptr = fi->extra_info;
792 else
793 {
794 fextra_info_ptr = &fextra_info;
795 s390_get_frame_info (s390_sniff_pc_function_start (fi->pc, fi),
796 fextra_info_ptr, fi, 1);
797 }
798 frameless = ((fextra_info_ptr->stack_bought == 0));
799 }
800 return frameless;
801
802}
803
804
805static int
806s390_is_sigreturn (CORE_ADDR pc, struct frame_info *sighandler_fi,
807 CORE_ADDR *sregs, CORE_ADDR *sigcaller_pc)
808{
809 bfd_byte instr[S390_MAX_INSTR_SIZE];
810 disassemble_info info;
811 int instrlen;
812 CORE_ADDR scontext;
813 int retval = 0;
814 CORE_ADDR orig_sp;
815 CORE_ADDR temp_sregs;
816
817 scontext = temp_sregs = 0;
818
819 info.read_memory_func = dis_asm_read_memory;
820 instrlen = s390_readinstruction (instr, pc, &info);
821 if (sigcaller_pc)
822 *sigcaller_pc = 0;
823 if (((instrlen == S390_SYSCALL_SIZE) &&
824 (instr[0] == S390_SYSCALL_OPCODE)) &&
825 ((instr[1] == s390_NR_sigreturn) || (instr[1] == s390_NR_rt_sigreturn)))
826 {
827 if (sighandler_fi)
828 {
829 if (s390_frameless_function_invocation (sighandler_fi))
830 orig_sp = sighandler_fi->frame;
831 else
832 orig_sp = ADDR_BITS_REMOVE ((CORE_ADDR)
833 read_memory_integer (sighandler_fi->
834 frame,
835 S390_GPR_SIZE));
836 if (orig_sp && sigcaller_pc)
837 {
838 scontext = orig_sp + S390_SIGNAL_FRAMESIZE;
839 if (pc == scontext && instr[1] == s390_NR_rt_sigreturn)
840 {
841 /* We got a new style rt_signal */
842 /* get address of read ucontext->uc_mcontext */
843 temp_sregs = orig_sp + (GDB_TARGET_IS_ESAME ?
844 S390X_UC_MCONTEXT_OFFSET :
845 S390_UC_MCONTEXT_OFFSET);
846 }
847 else
848 {
849 /* read sigcontext->sregs */
850 temp_sregs = ADDR_BITS_REMOVE ((CORE_ADDR)
851 read_memory_integer (scontext
852 +
853 (GDB_TARGET_IS_ESAME
854 ?
855 S390X_SIGCONTEXT_SREGS_OFFSET
856 :
857 S390_SIGCONTEXT_SREGS_OFFSET),
858 S390_GPR_SIZE));
859
860 }
861 /* read sigregs->psw.addr */
862 *sigcaller_pc =
863 ADDR_BITS_REMOVE ((CORE_ADDR)
864 read_memory_integer (temp_sregs +
865 REGISTER_BYTE
866 (S390_PC_REGNUM),
867 S390_PSW_ADDR_SIZE));
868 }
869 }
870 retval = 1;
871 }
872 if (sregs)
873 *sregs = temp_sregs;
874 return retval;
875}
876
877/*
878 We need to do something better here but this will keep us out of trouble
879 for the moment.
880 For some reason the blockframe.c calls us with fi->next->fromleaf
881 so this seems of little use to us. */
882void
883s390_init_frame_pc_first (int next_fromleaf, struct frame_info *fi)
884{
885 CORE_ADDR sigcaller_pc;
886
887 fi->pc = 0;
888 if (next_fromleaf)
889 {
890 fi->pc = ADDR_BITS_REMOVE (read_register (S390_RETADDR_REGNUM));
891 /* fix signal handlers */
892 }
893 else if (fi->next && fi->next->pc)
894 fi->pc = s390_frame_saved_pc_nofix (fi->next);
895 if (fi->pc && fi->next && fi->next->frame &&
896 s390_is_sigreturn (fi->pc, fi->next, NULL, &sigcaller_pc))
897 {
898 fi->pc = sigcaller_pc;
899 }
900
901}
902
903void
904s390_init_extra_frame_info (int fromleaf, struct frame_info *fi)
905{
906 fi->extra_info = frame_obstack_alloc (sizeof (struct frame_extra_info));
907 if (fi->pc)
908 s390_get_frame_info (s390_sniff_pc_function_start (fi->pc, fi),
909 fi->extra_info, fi, 1);
910 else
911 s390_memset_extra_info (fi->extra_info);
912}
913
914/* If saved registers of frame FI are not known yet, read and cache them.
915 &FEXTRA_INFOP contains struct frame_extra_info; TDATAP can be NULL,
916 in which case the framedata are read. */
917
918void
919s390_frame_init_saved_regs (struct frame_info *fi)
920{
921
922 int quick;
923
924 if (fi->saved_regs == NULL)
925 {
926 /* zalloc memsets the saved regs */
927 frame_saved_regs_zalloc (fi);
928 if (fi->pc)
929 {
930 quick = (fi->extra_info && fi->extra_info->initialised
931 && fi->extra_info->good_prologue);
932 s390_get_frame_info (quick ? fi->extra_info->function_start :
933 s390_sniff_pc_function_start (fi->pc, fi),
934 fi->extra_info, fi, !quick);
935 }
936 }
937}
938
939
940
941CORE_ADDR
942s390_frame_args_address (struct frame_info *fi)
943{
944
945 /* Apparently gdb already knows gdb_args_offset itself */
946 return fi->frame;
947}
948
949
950static CORE_ADDR
951s390_frame_saved_pc_nofix (struct frame_info *fi)
952{
953 if (fi->extra_info && fi->extra_info->saved_pc_valid)
954 return fi->extra_info->saved_pc;
5c3cf190
JB
955
956 if (generic_find_dummy_frame (fi->pc, fi->frame))
957 return generic_read_register_dummy (fi->pc, fi->frame, S390_PC_REGNUM);
958
5769d3cd
AC
959 s390_frame_init_saved_regs (fi);
960 if (fi->extra_info)
961 {
962 fi->extra_info->saved_pc_valid = 1;
963 if (fi->extra_info->good_prologue)
964 {
965 if (fi->saved_regs[S390_RETADDR_REGNUM])
966 {
967 return (fi->extra_info->saved_pc =
968 ADDR_BITS_REMOVE (read_memory_integer
969 (fi->saved_regs[S390_RETADDR_REGNUM],
970 S390_GPR_SIZE)));
971 }
d0ad30c9
JB
972 else
973 return read_register (S390_RETADDR_REGNUM);
5769d3cd
AC
974 }
975 }
976 return 0;
977}
978
979CORE_ADDR
980s390_frame_saved_pc (struct frame_info *fi)
981{
982 CORE_ADDR saved_pc = 0, sig_pc;
983
984 if (fi->extra_info && fi->extra_info->sig_fixed_saved_pc_valid)
985 return fi->extra_info->sig_fixed_saved_pc;
986 saved_pc = s390_frame_saved_pc_nofix (fi);
987
988 if (fi->extra_info)
989 {
990 fi->extra_info->sig_fixed_saved_pc_valid = 1;
991 if (saved_pc)
992 {
993 if (s390_is_sigreturn (saved_pc, fi, NULL, &sig_pc))
994 saved_pc = sig_pc;
995 }
996 fi->extra_info->sig_fixed_saved_pc = saved_pc;
997 }
998 return saved_pc;
999}
1000
1001
1002
1003
1004/* We want backtraces out of signal handlers so we don't
1005 set thisframe->signal_handler_caller to 1 */
1006
1007CORE_ADDR
1008s390_frame_chain (struct frame_info *thisframe)
1009{
1010 CORE_ADDR prev_fp = 0;
1011
1012 if (thisframe->prev && thisframe->prev->frame)
1013 prev_fp = thisframe->prev->frame;
5c3cf190
JB
1014 else if (generic_find_dummy_frame (thisframe->pc, thisframe->frame))
1015 return generic_read_register_dummy (thisframe->pc, thisframe->frame,
1016 S390_SP_REGNUM);
5769d3cd
AC
1017 else
1018 {
1019 int sigreturn = 0;
1020 CORE_ADDR sregs = 0;
1021 struct frame_extra_info prev_fextra_info;
1022
1023 memset (&prev_fextra_info, 0, sizeof (prev_fextra_info));
1024 if (thisframe->pc)
1025 {
1026 CORE_ADDR saved_pc, sig_pc;
1027
1028 saved_pc = s390_frame_saved_pc_nofix (thisframe);
1029 if (saved_pc)
1030 {
1031 if ((sigreturn =
1032 s390_is_sigreturn (saved_pc, thisframe, &sregs, &sig_pc)))
1033 saved_pc = sig_pc;
1034 s390_get_frame_info (s390_sniff_pc_function_start
1035 (saved_pc, NULL), &prev_fextra_info, NULL,
1036 1);
1037 }
1038 }
1039 if (sigreturn)
1040 {
1041 /* read sigregs,regs.gprs[11 or 15] */
1042 prev_fp = read_memory_integer (sregs +
1043 REGISTER_BYTE (S390_GP0_REGNUM +
1044 (prev_fextra_info.
1045 frame_pointer_saved_pc
1046 ? 11 : 15)),
1047 S390_GPR_SIZE);
1048 thisframe->extra_info->sigcontext = sregs;
1049 }
1050 else
1051 {
1052 if (thisframe->saved_regs)
1053 {
5769d3cd
AC
1054 int regno;
1055
31c4d430
JB
1056 if (prev_fextra_info.frame_pointer_saved_pc
1057 && thisframe->saved_regs[S390_FRAME_REGNUM])
1058 regno = S390_FRAME_REGNUM;
1059 else
1060 regno = S390_SP_REGNUM;
1061
5769d3cd 1062 if (thisframe->saved_regs[regno])
31c4d430
JB
1063 {
1064 /* The SP's entry of `saved_regs' is special. */
1065 if (regno == S390_SP_REGNUM)
1066 prev_fp = thisframe->saved_regs[regno];
1067 else
1068 prev_fp =
1069 read_memory_integer (thisframe->saved_regs[regno],
1070 S390_GPR_SIZE);
1071 }
5769d3cd
AC
1072 }
1073 }
1074 }
1075 return ADDR_BITS_REMOVE (prev_fp);
1076}
1077
1078/*
1079 Whether struct frame_extra_info is actually needed I'll have to figure
1080 out as our frames are similar to rs6000 there is a possibility
1081 i386 dosen't need it. */
1082
1083
1084
1085/* a given return value in `regbuf' with a type `valtype', extract and copy its
1086 value into `valbuf' */
1087void
1088s390_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
1089{
1090 /* floats and doubles are returned in fpr0. fpr's have a size of 8 bytes.
1091 We need to truncate the return value into float size (4 byte) if
1092 necessary. */
1093 int len = TYPE_LENGTH (valtype);
1094
1095 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
f2c6cfba 1096 memcpy (valbuf, &regbuf[REGISTER_BYTE (S390_FP0_REGNUM)], len);
5769d3cd
AC
1097 else
1098 {
1099 int offset = 0;
1100 /* return value is copied starting from r2. */
1101 if (TYPE_LENGTH (valtype) < S390_GPR_SIZE)
1102 offset = S390_GPR_SIZE - TYPE_LENGTH (valtype);
1103 memcpy (valbuf,
1104 regbuf + REGISTER_BYTE (S390_GP0_REGNUM + 2) + offset,
1105 TYPE_LENGTH (valtype));
1106 }
1107}
1108
1109
1110static char *
1111s390_promote_integer_argument (struct type *valtype, char *valbuf,
1112 char *reg_buff, int *arglen)
1113{
1114 char *value = valbuf;
1115 int len = TYPE_LENGTH (valtype);
1116
1117 if (len < S390_GPR_SIZE)
1118 {
1119 /* We need to upgrade this value to a register to pass it correctly */
1120 int idx, diff = S390_GPR_SIZE - len, negative =
1121 (!TYPE_UNSIGNED (valtype) && value[0] & 0x80);
1122 for (idx = 0; idx < S390_GPR_SIZE; idx++)
1123 {
1124 reg_buff[idx] = (idx < diff ? (negative ? 0xff : 0x0) :
1125 value[idx - diff]);
1126 }
1127 value = reg_buff;
1128 *arglen = S390_GPR_SIZE;
1129 }
1130 else
1131 {
1132 if (len & (S390_GPR_SIZE - 1))
1133 {
1134 fprintf_unfiltered (gdb_stderr,
1135 "s390_promote_integer_argument detected an argument not "
1136 "a multiple of S390_GPR_SIZE & greater than S390_GPR_SIZE "
1137 "we might not deal with this correctly.\n");
1138 }
1139 *arglen = len;
1140 }
1141
1142 return (value);
1143}
1144
1145void
1146s390_store_return_value (struct type *valtype, char *valbuf)
1147{
1148 int arglen;
1149 char *reg_buff = alloca (max (S390_FPR_SIZE, REGISTER_SIZE)), *value;
1150
1151 if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
1152 {
03a013f4
JB
1153 if (TYPE_LENGTH (valtype) == 4
1154 || TYPE_LENGTH (valtype) == 8)
1155 write_register_bytes (REGISTER_BYTE (S390_FP0_REGNUM), valbuf,
1156 TYPE_LENGTH (valtype));
1157 else
1158 error ("GDB is unable to return `long double' values "
1159 "on this architecture.");
5769d3cd
AC
1160 }
1161 else
1162 {
1163 value =
1164 s390_promote_integer_argument (valtype, valbuf, reg_buff, &arglen);
1165 /* Everything else is returned in GPR2 and up. */
1166 write_register_bytes (REGISTER_BYTE (S390_GP0_REGNUM + 2), value,
1167 arglen);
1168 }
1169}
1170static int
1171gdb_print_insn_s390 (bfd_vma memaddr, disassemble_info * info)
1172{
1173 bfd_byte instrbuff[S390_MAX_INSTR_SIZE];
1174 int instrlen, cnt;
1175
1176 instrlen = s390_readinstruction (instrbuff, (CORE_ADDR) memaddr, info);
1177 if (instrlen < 0)
1178 {
1179 (*info->memory_error_func) (instrlen, memaddr, info);
1180 return -1;
1181 }
1182 for (cnt = 0; cnt < instrlen; cnt++)
1183 info->fprintf_func (info->stream, "%02X ", instrbuff[cnt]);
1184 for (cnt = instrlen; cnt < S390_MAX_INSTR_SIZE; cnt++)
1185 info->fprintf_func (info->stream, " ");
1186 instrlen = print_insn_s390 (memaddr, info);
1187 return instrlen;
1188}
1189
1190
1191
1192/* Not the most efficent code in the world */
1193int
1194s390_fp_regnum ()
1195{
1196 int regno = S390_SP_REGNUM;
1197 struct frame_extra_info fextra_info;
1198
1199 CORE_ADDR pc = ADDR_BITS_REMOVE (read_register (S390_PC_REGNUM));
1200
1201 s390_get_frame_info (s390_sniff_pc_function_start (pc, NULL), &fextra_info,
1202 NULL, 1);
1203 if (fextra_info.frame_pointer_saved_pc)
1204 regno = S390_FRAME_REGNUM;
1205 return regno;
1206}
1207
1208CORE_ADDR
1209s390_read_fp ()
1210{
1211 return read_register (s390_fp_regnum ());
1212}
1213
1214
1215void
1216s390_write_fp (CORE_ADDR val)
1217{
1218 write_register (s390_fp_regnum (), val);
1219}
1220
1221
4c8287ac
JB
1222static void
1223s390_pop_frame_regular (struct frame_info *frame)
5769d3cd 1224{
4c8287ac
JB
1225 int regnum;
1226
1227 write_register (S390_PC_REGNUM, FRAME_SAVED_PC (frame));
1228
1229 /* Restore any saved registers. */
1230 for (regnum = 0; regnum < NUM_REGS; regnum++)
1231 if (frame->saved_regs[regnum] != 0)
1232 {
1233 ULONGEST value;
1234
1235 value = read_memory_unsigned_integer (frame->saved_regs[regnum],
1236 REGISTER_RAW_SIZE (regnum));
1237 write_register (regnum, value);
1238 }
5769d3cd 1239
9a1befc9
JB
1240 /* Actually cut back the stack. Remember that the SP's element of
1241 saved_regs is the old SP itself, not the address at which it is
1242 saved. */
1243 write_register (S390_SP_REGNUM, frame->saved_regs[S390_SP_REGNUM]);
5769d3cd 1244
4c8287ac
JB
1245 /* Throw away any cached frame information. */
1246 flush_cached_frames ();
5769d3cd
AC
1247}
1248
4c8287ac
JB
1249
1250/* Destroy the innermost (Top-Of-Stack) stack frame, restoring the
1251 machine state that was in effect before the frame was created.
1252 Used in the contexts of the "return" command, and of
1253 target function calls from the debugger. */
1254void
1255s390_pop_frame ()
1256{
1257 /* This function checks for and handles generic dummy frames, and
1258 calls back to our function for ordinary frames. */
1259 generic_pop_current_frame (s390_pop_frame_regular);
1260}
1261
1262
78f8b424
JB
1263/* Return non-zero if TYPE is an integer-like type, zero otherwise.
1264 "Integer-like" types are those that should be passed the way
1265 integers are: integers, enums, ranges, characters, and booleans. */
1266static int
1267is_integer_like (struct type *type)
1268{
1269 enum type_code code = TYPE_CODE (type);
1270
1271 return (code == TYPE_CODE_INT
1272 || code == TYPE_CODE_ENUM
1273 || code == TYPE_CODE_RANGE
1274 || code == TYPE_CODE_CHAR
1275 || code == TYPE_CODE_BOOL);
1276}
1277
1278
1279/* Return non-zero if TYPE is a pointer-like type, zero otherwise.
1280 "Pointer-like" types are those that should be passed the way
1281 pointers are: pointers and references. */
1282static int
1283is_pointer_like (struct type *type)
1284{
1285 enum type_code code = TYPE_CODE (type);
1286
1287 return (code == TYPE_CODE_PTR
1288 || code == TYPE_CODE_REF);
1289}
1290
1291
20a940cc
JB
1292/* Return non-zero if TYPE is a `float singleton' or `double
1293 singleton', zero otherwise.
1294
1295 A `T singleton' is a struct type with one member, whose type is
1296 either T or a `T singleton'. So, the following are all float
1297 singletons:
1298
1299 struct { float x };
1300 struct { struct { float x; } x; };
1301 struct { struct { struct { float x; } x; } x; };
1302
1303 ... and so on.
1304
1305 WHY THE HECK DO WE CARE ABOUT THIS??? Well, it turns out that GCC
1306 passes all float singletons and double singletons as if they were
1307 simply floats or doubles. This is *not* what the ABI says it
1308 should do. */
1309static int
1310is_float_singleton (struct type *type)
1311{
1312 return (TYPE_CODE (type) == TYPE_CODE_STRUCT
1313 && TYPE_NFIELDS (type) == 1
1314 && (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_FLT
1315 || is_float_singleton (TYPE_FIELD_TYPE (type, 0))));
1316}
1317
1318
1319/* Return non-zero if TYPE is a struct-like type, zero otherwise.
1320 "Struct-like" types are those that should be passed as structs are:
1321 structs and unions.
1322
1323 As an odd quirk, not mentioned in the ABI, GCC passes float and
1324 double singletons as if they were a plain float, double, etc. (The
1325 corresponding union types are handled normally.) So we exclude
1326 those types here. *shrug* */
1327static int
1328is_struct_like (struct type *type)
1329{
1330 enum type_code code = TYPE_CODE (type);
1331
1332 return (code == TYPE_CODE_UNION
1333 || (code == TYPE_CODE_STRUCT && ! is_float_singleton (type)));
1334}
1335
1336
1337/* Return non-zero if TYPE is a float-like type, zero otherwise.
1338 "Float-like" types are those that should be passed as
1339 floating-point values are.
1340
1341 You'd think this would just be floats, doubles, long doubles, etc.
1342 But as an odd quirk, not mentioned in the ABI, GCC passes float and
1343 double singletons as if they were a plain float, double, etc. (The
1344 corresponding union types are handled normally.) So we exclude
1345 those types here. *shrug* */
1346static int
1347is_float_like (struct type *type)
1348{
1349 return (TYPE_CODE (type) == TYPE_CODE_FLT
1350 || is_float_singleton (type));
1351}
1352
1353
78f8b424
JB
1354/* Return non-zero if TYPE is considered a `DOUBLE_OR_FLOAT', as
1355 defined by the parameter passing conventions described in the
1356 "Linux for S/390 ELF Application Binary Interface Supplement".
1357 Otherwise, return zero. */
1358static int
1359is_double_or_float (struct type *type)
1360{
20a940cc 1361 return (is_float_like (type)
78f8b424
JB
1362 && (TYPE_LENGTH (type) == 4
1363 || TYPE_LENGTH (type) == 8));
1364}
1365
5769d3cd 1366
78f8b424
JB
1367/* Return non-zero if TYPE is considered a `SIMPLE_ARG', as defined by
1368 the parameter passing conventions described in the "Linux for S/390
1369 ELF Application Binary Interface Supplement". Return zero otherwise. */
1370static int
1371is_simple_arg (struct type *type)
1372{
78f8b424
JB
1373 unsigned length = TYPE_LENGTH (type);
1374
a1677dfb
JB
1375 /* This is almost a direct translation of the ABI's language, except
1376 that we have to exclude 8-byte structs; those are DOUBLE_ARGs. */
78f8b424
JB
1377 return ((is_integer_like (type) && length <= 4)
1378 || is_pointer_like (type)
20a940cc
JB
1379 || (is_struct_like (type) && length != 8)
1380 || (is_float_like (type) && length == 16));
78f8b424
JB
1381}
1382
1383
1384/* Return non-zero if TYPE should be passed as a pointer to a copy,
1385 zero otherwise. TYPE must be a SIMPLE_ARG, as recognized by
1386 `is_simple_arg'. */
1387static int
1388pass_by_copy_ref (struct type *type)
1389{
78f8b424
JB
1390 unsigned length = TYPE_LENGTH (type);
1391
20a940cc
JB
1392 return ((is_struct_like (type) && length != 1 && length != 2 && length != 4)
1393 || (is_float_like (type) && length == 16));
78f8b424
JB
1394}
1395
1396
1397/* Return ARG, a `SIMPLE_ARG', sign-extended or zero-extended to a full
1398 word as required for the ABI. */
1399static LONGEST
1400extend_simple_arg (struct value *arg)
1401{
1402 struct type *type = VALUE_TYPE (arg);
1403
1404 /* Even structs get passed in the least significant bits of the
1405 register / memory word. It's not really right to extract them as
1406 an integer, but it does take care of the extension. */
1407 if (TYPE_UNSIGNED (type))
1408 return extract_unsigned_integer (VALUE_CONTENTS (arg),
1409 TYPE_LENGTH (type));
1410 else
1411 return extract_signed_integer (VALUE_CONTENTS (arg),
1412 TYPE_LENGTH (type));
1413}
1414
1415
1416/* Return non-zero if TYPE is a `DOUBLE_ARG', as defined by the
1417 parameter passing conventions described in the "Linux for S/390 ELF
1418 Application Binary Interface Supplement". Return zero otherwise. */
1419static int
1420is_double_arg (struct type *type)
1421{
78f8b424
JB
1422 unsigned length = TYPE_LENGTH (type);
1423
1424 return ((is_integer_like (type)
20a940cc 1425 || is_struct_like (type))
78f8b424
JB
1426 && length == 8);
1427}
1428
1429
1430/* Round ADDR up to the next N-byte boundary. N must be a power of
1431 two. */
1432static CORE_ADDR
1433round_up (CORE_ADDR addr, int n)
1434{
1435 /* Check that N is really a power of two. */
1436 gdb_assert (n && (n & (n-1)) == 0);
1437 return ((addr + n - 1) & -n);
1438}
1439
1440
1441/* Round ADDR down to the next N-byte boundary. N must be a power of
1442 two. */
1443static CORE_ADDR
1444round_down (CORE_ADDR addr, int n)
1445{
1446 /* Check that N is really a power of two. */
1447 gdb_assert (n && (n & (n-1)) == 0);
1448 return (addr & -n);
1449}
1450
1451
1452/* Return the alignment required by TYPE. */
1453static int
1454alignment_of (struct type *type)
1455{
1456 int alignment;
1457
1458 if (is_integer_like (type)
1459 || is_pointer_like (type)
1460 || TYPE_CODE (type) == TYPE_CODE_FLT)
1461 alignment = TYPE_LENGTH (type);
1462 else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
1463 || TYPE_CODE (type) == TYPE_CODE_UNION)
1464 {
1465 int i;
1466
1467 alignment = 1;
1468 for (i = 0; i < TYPE_NFIELDS (type); i++)
1469 {
1470 int field_alignment = alignment_of (TYPE_FIELD_TYPE (type, i));
1471
1472 if (field_alignment > alignment)
1473 alignment = field_alignment;
1474 }
1475 }
1476 else
1477 alignment = 1;
1478
1479 /* Check that everything we ever return is a power of two. Lots of
1480 code doesn't want to deal with aligning things to arbitrary
1481 boundaries. */
1482 gdb_assert ((alignment & (alignment - 1)) == 0);
1483
1484 return alignment;
1485}
1486
1487
1488/* Put the actual parameter values pointed to by ARGS[0..NARGS-1] in
1489 place to be passed to a function, as specified by the "Linux for
1490 S/390 ELF Application Binary Interface Supplement".
1491
1492 SP is the current stack pointer. We must put arguments, links,
1493 padding, etc. whereever they belong, and return the new stack
1494 pointer value.
1495
1496 If STRUCT_RETURN is non-zero, then the function we're calling is
1497 going to return a structure by value; STRUCT_ADDR is the address of
1498 a block we've allocated for it on the stack.
1499
1500 Our caller has taken care of any type promotions needed to satisfy
1501 prototypes or the old K&R argument-passing rules. */
5769d3cd 1502CORE_ADDR
d45fc520 1503s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
5769d3cd
AC
1504 int struct_return, CORE_ADDR struct_addr)
1505{
78f8b424
JB
1506 int i;
1507 int pointer_size = (TARGET_PTR_BIT / TARGET_CHAR_BIT);
5769d3cd 1508
78f8b424
JB
1509 /* The number of arguments passed by reference-to-copy. */
1510 int num_copies;
5769d3cd 1511
78f8b424
JB
1512 /* If the i'th argument is passed as a reference to a copy, then
1513 copy_addr[i] is the address of the copy we made. */
1514 CORE_ADDR *copy_addr = alloca (nargs * sizeof (CORE_ADDR));
5769d3cd 1515
78f8b424
JB
1516 /* Build the reference-to-copy area. */
1517 num_copies = 0;
1518 for (i = 0; i < nargs; i++)
1519 {
1520 struct value *arg = args[i];
1521 struct type *type = VALUE_TYPE (arg);
1522 unsigned length = TYPE_LENGTH (type);
5769d3cd 1523
78f8b424
JB
1524 if (is_simple_arg (type)
1525 && pass_by_copy_ref (type))
01c464e9 1526 {
78f8b424
JB
1527 sp -= length;
1528 sp = round_down (sp, alignment_of (type));
1529 write_memory (sp, VALUE_CONTENTS (arg), length);
1530 copy_addr[i] = sp;
1531 num_copies++;
01c464e9 1532 }
5769d3cd 1533 }
5769d3cd 1534
78f8b424
JB
1535 /* Reserve space for the parameter area. As a conservative
1536 simplification, we assume that everything will be passed on the
1537 stack. */
1538 {
1539 int i;
1540
1541 for (i = 0; i < nargs; i++)
1542 {
1543 struct value *arg = args[i];
1544 struct type *type = VALUE_TYPE (arg);
1545 int length = TYPE_LENGTH (type);
1546
1547 sp = round_down (sp, alignment_of (type));
1548
1549 /* SIMPLE_ARG values get extended to 32 bits. Assume every
1550 argument is. */
1551 if (length < 4) length = 4;
1552 sp -= length;
1553 }
1554 }
1555
1556 /* Include space for any reference-to-copy pointers. */
1557 sp = round_down (sp, pointer_size);
1558 sp -= num_copies * pointer_size;
1559
1560 /* After all that, make sure it's still aligned on an eight-byte
1561 boundary. */
1562 sp = round_down (sp, 8);
1563
1564 /* Finally, place the actual parameters, working from SP towards
1565 higher addresses. The code above is supposed to reserve enough
1566 space for this. */
1567 {
1568 int fr = 0;
1569 int gr = 2;
1570 CORE_ADDR starg = sp;
1571
1572 for (i = 0; i < nargs; i++)
1573 {
1574 struct value *arg = args[i];
1575 struct type *type = VALUE_TYPE (arg);
1576
1577 if (is_double_or_float (type)
1578 && fr <= 2)
1579 {
1580 /* When we store a single-precision value in an FP register,
1581 it occupies the leftmost bits. */
1582 write_register_bytes (REGISTER_BYTE (S390_FP0_REGNUM + fr),
1583 VALUE_CONTENTS (arg),
1584 TYPE_LENGTH (type));
1585 fr += 2;
1586 }
1587 else if (is_simple_arg (type)
1588 && gr <= 6)
1589 {
1590 /* Do we need to pass a pointer to our copy of this
1591 argument? */
1592 if (pass_by_copy_ref (type))
1593 write_register (S390_GP0_REGNUM + gr, copy_addr[i]);
1594 else
1595 write_register (S390_GP0_REGNUM + gr, extend_simple_arg (arg));
1596
1597 gr++;
1598 }
1599 else if (is_double_arg (type)
1600 && gr <= 5)
1601 {
1602 write_register_gen (S390_GP0_REGNUM + gr,
1603 VALUE_CONTENTS (arg));
1604 write_register_gen (S390_GP0_REGNUM + gr + 1,
1605 VALUE_CONTENTS (arg) + 4);
1606 gr += 2;
1607 }
1608 else
1609 {
1610 /* The `OTHER' case. */
1611 enum type_code code = TYPE_CODE (type);
1612 unsigned length = TYPE_LENGTH (type);
1613
1614 /* If we skipped r6 because we couldn't fit a DOUBLE_ARG
1615 in it, then don't go back and use it again later. */
1616 if (is_double_arg (type) && gr == 6)
1617 gr = 7;
1618
1619 if (is_simple_arg (type))
1620 {
1621 /* Simple args are always either extended to 32 bits,
1622 or pointers. */
1623 starg = round_up (starg, 4);
1624
1625 /* Do we need to pass a pointer to our copy of this
1626 argument? */
1627 if (pass_by_copy_ref (type))
1628 write_memory_signed_integer (starg, pointer_size,
1629 copy_addr[i]);
1630 else
1631 /* Simple args are always extended to 32 bits. */
1632 write_memory_signed_integer (starg, 4,
1633 extend_simple_arg (arg));
1634 starg += 4;
1635 }
1636 else
1637 {
20a940cc
JB
1638 /* You'd think we should say:
1639 starg = round_up (starg, alignment_of (type));
1640 Unfortunately, GCC seems to simply align the stack on
1641 a four-byte boundary, even when passing doubles. */
1642 starg = round_up (starg, 4);
78f8b424
JB
1643 write_memory (starg, VALUE_CONTENTS (arg), length);
1644 starg += length;
1645 }
1646 }
1647 }
1648 }
1649
1650 /* Allocate the standard frame areas: the register save area, the
1651 word reserved for the compiler (which seems kind of meaningless),
1652 and the back chain pointer. */
1653 sp -= 96;
1654
1655 /* Write the back chain pointer into the first word of the stack
1656 frame. This will help us get backtraces from within functions
1657 called from GDB. */
1658 write_memory_unsigned_integer (sp, (TARGET_PTR_BIT / TARGET_CHAR_BIT),
1659 read_fp ());
1660
1661 return sp;
5769d3cd
AC
1662}
1663
c8f9d51c
JB
1664
1665static int
1666s390_use_struct_convention (int gcc_p, struct type *value_type)
1667{
1668 enum type_code code = TYPE_CODE (value_type);
1669
1670 return (code == TYPE_CODE_STRUCT
1671 || code == TYPE_CODE_UNION);
1672}
1673
1674
5769d3cd
AC
1675/* Return the GDB type object for the "standard" data type
1676 of data in register N. */
1677struct type *
1678s390_register_virtual_type (int regno)
1679{
b09677dc
JB
1680 if (S390_FP0_REGNUM <= regno && regno < S390_FP0_REGNUM + S390_NUM_FPRS)
1681 return builtin_type_double;
1682 else
1683 return builtin_type_int;
5769d3cd
AC
1684}
1685
1686
1687struct type *
1688s390x_register_virtual_type (int regno)
1689{
1690 return (regno == S390_FPC_REGNUM) ||
1691 (regno >= S390_FIRST_ACR && regno <= S390_LAST_ACR) ? builtin_type_int :
1692 (regno >= S390_FP0_REGNUM) ? builtin_type_double : builtin_type_long;
1693}
1694
1695
1696
1697void
1698s390_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
1699{
1700 write_register (S390_GP0_REGNUM + 2, addr);
1701}
1702
1703
1704
1705static unsigned char *
1706s390_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
1707{
1708 static unsigned char breakpoint[] = { 0x0, 0x1 };
1709
1710 *lenptr = sizeof (breakpoint);
1711 return breakpoint;
1712}
1713
1714/* Advance PC across any function entry prologue instructions to reach some
1715 "real" code. */
1716CORE_ADDR
1717s390_skip_prologue (CORE_ADDR pc)
1718{
1719 struct frame_extra_info fextra_info;
1720
1721 s390_get_frame_info (pc, &fextra_info, NULL, 1);
1722 return fextra_info.skip_prologue_function_start;
1723}
1724
5769d3cd
AC
1725/* Immediately after a function call, return the saved pc.
1726 Can't go through the frames for this because on some machines
1727 the new frame is not set up until the new function executes
1728 some instructions. */
1729CORE_ADDR
1730s390_saved_pc_after_call (struct frame_info *frame)
1731{
1732 return ADDR_BITS_REMOVE (read_register (S390_RETADDR_REGNUM));
1733}
1734
1735static CORE_ADDR
1736s390_addr_bits_remove (CORE_ADDR addr)
1737{
1738 return (addr) & 0x7fffffff;
1739}
1740
1741
1742static CORE_ADDR
1743s390_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
1744{
d4d0c21e 1745 write_register (S390_RETADDR_REGNUM, CALL_DUMMY_ADDRESS ());
5769d3cd
AC
1746 return sp;
1747}
1748
1749struct gdbarch *
1750s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1751{
d4d0c21e 1752 static LONGEST s390_call_dummy_words[] = { 0 };
5769d3cd
AC
1753 struct gdbarch *gdbarch;
1754 struct gdbarch_tdep *tdep;
1755 int elf_flags;
1756
1757 /* First see if there is already a gdbarch that can satisfy the request. */
1758 arches = gdbarch_list_lookup_by_info (arches, &info);
1759 if (arches != NULL)
1760 return arches->gdbarch;
1761
1762 /* None found: is the request for a s390 architecture? */
1763 if (info.bfd_arch_info->arch != bfd_arch_s390)
1764 return NULL; /* No; then it's not for us. */
1765
1766 /* Yes: create a new gdbarch for the specified machine type. */
1767 gdbarch = gdbarch_alloc (&info, NULL);
1768
1769 set_gdbarch_believe_pcc_promotion (gdbarch, 0);
4e409299 1770 set_gdbarch_char_signed (gdbarch, 0);
5769d3cd 1771
5769d3cd
AC
1772 set_gdbarch_frame_args_skip (gdbarch, 0);
1773 set_gdbarch_frame_args_address (gdbarch, s390_frame_args_address);
1774 set_gdbarch_frame_chain (gdbarch, s390_frame_chain);
1775 set_gdbarch_frame_init_saved_regs (gdbarch, s390_frame_init_saved_regs);
1776 set_gdbarch_frame_locals_address (gdbarch, s390_frame_args_address);
1777 /* We can't do this */
1778 set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
1779 set_gdbarch_store_struct_return (gdbarch, s390_store_struct_return);
1780 set_gdbarch_extract_return_value (gdbarch, s390_extract_return_value);
1781 set_gdbarch_store_return_value (gdbarch, s390_store_return_value);
1782 /* Amount PC must be decremented by after a breakpoint.
1783 This is often the number of bytes in BREAKPOINT
1784 but not always. */
1785 set_gdbarch_decr_pc_after_break (gdbarch, 2);
1786 set_gdbarch_pop_frame (gdbarch, s390_pop_frame);
5769d3cd
AC
1787 set_gdbarch_ieee_float (gdbarch, 1);
1788 /* Stack grows downward. */
1789 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
1790 /* Offset from address of function to start of its code.
1791 Zero on most machines. */
1792 set_gdbarch_function_start_offset (gdbarch, 0);
1793 set_gdbarch_max_register_raw_size (gdbarch, 8);
1794 set_gdbarch_max_register_virtual_size (gdbarch, 8);
1795 set_gdbarch_breakpoint_from_pc (gdbarch, s390_breakpoint_from_pc);
1796 set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue);
1797 set_gdbarch_init_extra_frame_info (gdbarch, s390_init_extra_frame_info);
1798 set_gdbarch_init_frame_pc_first (gdbarch, s390_init_frame_pc_first);
1799 set_gdbarch_read_fp (gdbarch, s390_read_fp);
1800 set_gdbarch_write_fp (gdbarch, s390_write_fp);
1801 /* This function that tells us whether the function invocation represented
1802 by FI does not have a frame on the stack associated with it. If it
1803 does not, FRAMELESS is set to 1, else 0. */
1804 set_gdbarch_frameless_function_invocation (gdbarch,
1805 s390_frameless_function_invocation);
1806 /* Return saved PC from a frame */
1807 set_gdbarch_frame_saved_pc (gdbarch, s390_frame_saved_pc);
1808 /* FRAME_CHAIN takes a frame's nominal address
1809 and produces the frame's chain-pointer. */
1810 set_gdbarch_frame_chain (gdbarch, s390_frame_chain);
1811 set_gdbarch_saved_pc_after_call (gdbarch, s390_saved_pc_after_call);
1812 set_gdbarch_register_byte (gdbarch, s390_register_byte);
1813 set_gdbarch_pc_regnum (gdbarch, S390_PC_REGNUM);
1814 set_gdbarch_sp_regnum (gdbarch, S390_SP_REGNUM);
1815 set_gdbarch_fp_regnum (gdbarch, S390_FP_REGNUM);
1816 set_gdbarch_fp0_regnum (gdbarch, S390_FP0_REGNUM);
1817 set_gdbarch_num_regs (gdbarch, S390_NUM_REGS);
1818 set_gdbarch_cannot_fetch_register (gdbarch, s390_cannot_fetch_register);
1819 set_gdbarch_cannot_store_register (gdbarch, s390_cannot_fetch_register);
1820 set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
c8f9d51c 1821 set_gdbarch_use_struct_convention (gdbarch, s390_use_struct_convention);
8001d1e4 1822 set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
5769d3cd
AC
1823 set_gdbarch_register_name (gdbarch, s390_register_name);
1824 set_gdbarch_stab_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
1825 set_gdbarch_dwarf_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
1826 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
c8f9d51c
JB
1827 set_gdbarch_extract_struct_value_address
1828 (gdbarch, generic_cannot_extract_struct_value_address);
5769d3cd 1829
d4d0c21e 1830 /* Parameters for inferior function calls. */
5769d3cd 1831 set_gdbarch_call_dummy_p (gdbarch, 1);
d4d0c21e
JB
1832 set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
1833 set_gdbarch_call_dummy_length (gdbarch, 0);
1834 set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
1835 set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
1836 set_gdbarch_call_dummy_start_offset (gdbarch, 0);
1837 set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
1838 set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
1839 set_gdbarch_push_arguments (gdbarch, s390_push_arguments);
5c3cf190 1840 set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
d4d0c21e
JB
1841 set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
1842 set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
5769d3cd 1843 set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
d4d0c21e 1844 set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
5769d3cd 1845 set_gdbarch_push_return_address (gdbarch, s390_push_return_address);
d4d0c21e
JB
1846 set_gdbarch_sizeof_call_dummy_words (gdbarch,
1847 sizeof (s390_call_dummy_words));
1848 set_gdbarch_call_dummy_words (gdbarch, s390_call_dummy_words);
0adb2aba
JB
1849 set_gdbarch_coerce_float_to_double (gdbarch,
1850 standard_coerce_float_to_double);
5769d3cd
AC
1851
1852 switch (info.bfd_arch_info->mach)
1853 {
1854 case bfd_mach_s390_esa:
1855 set_gdbarch_register_size (gdbarch, 4);
5769d3cd
AC
1856 set_gdbarch_register_raw_size (gdbarch, s390_register_raw_size);
1857 set_gdbarch_register_virtual_size (gdbarch, s390_register_raw_size);
1858 set_gdbarch_register_virtual_type (gdbarch, s390_register_virtual_type);
1859
1860 set_gdbarch_addr_bits_remove (gdbarch, s390_addr_bits_remove);
5769d3cd
AC
1861 set_gdbarch_register_bytes (gdbarch, S390_REGISTER_BYTES);
1862 break;
1863 case bfd_mach_s390_esame:
1864 set_gdbarch_register_size (gdbarch, 8);
5769d3cd
AC
1865 set_gdbarch_register_raw_size (gdbarch, s390x_register_raw_size);
1866 set_gdbarch_register_virtual_size (gdbarch, s390x_register_raw_size);
1867 set_gdbarch_register_virtual_type (gdbarch,
1868 s390x_register_virtual_type);
1869
1870 set_gdbarch_long_bit (gdbarch, 64);
1871 set_gdbarch_long_long_bit (gdbarch, 64);
1872 set_gdbarch_ptr_bit (gdbarch, 64);
5769d3cd
AC
1873 set_gdbarch_register_bytes (gdbarch, S390X_REGISTER_BYTES);
1874 break;
1875 }
1876
1877 return gdbarch;
1878}
1879
1880
1881
1882void
1883_initialize_s390_tdep ()
1884{
1885
1886 /* Hook us into the gdbarch mechanism. */
1887 register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init);
1888 if (!tm_print_insn) /* Someone may have already set it */
1889 tm_print_insn = gdb_print_insn_s390;
1890}
1891
1892#endif /* GDBSERVER */
This page took 0.120665 seconds and 4 git commands to generate.