diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2008-02-27 03:31:05 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2008-02-27 03:31:05 +0000 |
commit | d61ddec43526d69a4625f46671b2c1b5bea9fa88 (patch) | |
tree | cb622461dc0b6d50a64facfb420e54c883425565 /gdb/gdbserver/linux-s390-low.c | |
parent | d05b4ac3aadc6a37e44f1b80e190fe80cea4d6d7 (diff) | |
download | gdb-d61ddec43526d69a4625f46671b2c1b5bea9fa88.zip gdb-d61ddec43526d69a4625f46671b2c1b5bea9fa88.tar.gz gdb-d61ddec43526d69a4625f46671b2c1b5bea9fa88.tar.bz2 |
* configure.srv [s390x-*-linux*]: Set srv_regobj to include both
reg-s390.o and reg-s390x.o.
* linux-low.c (new_inferior): New global variable.
(linux_create_inferior, linux_attach): Set it.
(linux_wait_for_process): Call the_low_target.arch_setup after the
target has stopped for the first time.
(initialize_low): Do not call the_low_target.arch_setup.
* linux-s390-low.c (s390_get_pc): Support bi-arch operation.
(s390_set_pc): Likewise.
(s390_arch_setup): New function.
(the_low_target): Use s390_arch_setup as arch_setup routine.
* regcache.c (realloc_register_cache): New function.
(set_register_cache): Call it for each existing regcache.
Diffstat (limited to 'gdb/gdbserver/linux-s390-low.c')
-rw-r--r-- | gdb/gdbserver/linux-s390-low.c | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c index 6ae1a23..d6739ab 100644 --- a/gdb/gdbserver/linux-s390-low.c +++ b/gdb/gdbserver/linux-s390-low.c @@ -102,24 +102,61 @@ static const unsigned char s390_breakpoint[] = { 0, 1 }; static CORE_ADDR s390_get_pc () { - unsigned long pc; - collect_register_by_name ("pswa", &pc); + if (register_size (0) == 4) + { + unsigned int pc; + collect_register_by_name ("pswa", &pc); #ifndef __s390x__ - pc &= 0x7fffffff; + pc &= 0x7fffffff; #endif - return pc; + return pc; + } + else + { + unsigned long pc; + collect_register_by_name ("pswa", &pc); + return pc; + } } static void s390_set_pc (CORE_ADDR newpc) { - unsigned long pc = newpc; + if (register_size (0) == 4) + { + unsigned int pc = newpc; #ifndef __s390x__ - pc |= 0x80000000; + pc |= 0x80000000; #endif - supply_register_by_name ("pswa", &pc); + supply_register_by_name ("pswa", &pc); + } + else + { + unsigned long pc = newpc; + supply_register_by_name ("pswa", &pc); + } } + +static void +s390_arch_setup (void) +{ + /* Assume 31-bit inferior process. */ + init_registers_s390 (); + + /* On a 64-bit host, check the low bit of the (31-bit) PSWM + -- if this is one, we actually have a 64-bit inferior. */ +#ifdef __s390x__ + { + unsigned int pswm; + collect_register_by_name ("pswm", &pswm); + if (pswm & 1) + init_registers_s390x (); + } +#endif +} + + static int s390_breakpoint_at (CORE_ADDR pc) { @@ -130,11 +167,7 @@ s390_breakpoint_at (CORE_ADDR pc) struct linux_target_ops the_low_target = { -#ifndef __s390x__ - init_registers_s390, -#else - init_registers_s390x, -#endif + s390_arch_setup, s390_num_regs, s390_regmap, s390_cannot_fetch_register, |