Re: New gdb 31 & 64 bit patches for S/390

Denis Joseph Barrow
2001-07-05T05:04:00Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2411 bytes --]

The code below was trying to access registers several supervisor/priviliged
mode registers,
which arent accessible from the ptrace syscall or in core files, these
registers do exist & will be used for
kernel debugging.

Its a long time ago & I can't remember the exact symtom but the code caused
incorrect behaviour on s390,
possibly bad_reg going to 1 & it doing a quick exit.

D.J. Barrow Gnu/Linux for S/390 kernel developer
eMail: djbarrow@de.ibm.com,barrow_dj@yahoo.com
Phone: +49-(0)7031-16-2583
IBM Germany Lab, SchÃ¶naicherstr. 220, 71032 BÃ¶blingen

Andrew Cagney <ac131313@cygnus.com> on 04.07.2001 19:13:53

Please respond to Andrew Cagney <ac131313@cygnus.com>

To: Denis Joseph Barrow/Germany/Contr/IBM@IBMDE
cc: gdb-patches@sourceware.cygnus.com, s390-patches@gnu.org, Binutils
Patches <binutils@sourceware.cygnus.com>, bash_maintainers@gnu.org,
Martin Schwidefsky/Germany/IBM@IBMDE, Christoph
Arenz/Germany/IBM@IBMDE
Subject: Re: New gdb 31 & 64 bit patches for S/390

DJB,

The patches included the change:

2001-02-26 D.J. Barrow <djbarrow@de.ibm.com,barrow_dj@yahoo.com>

* core-aout.c added check for CANNOT_FETCH_REGISTER
in fetch_core_registers.

--- src.orig/gdb/core-aout.c Sun Jul 30 03:48:24 2000
+++ src.new/gdb/core-aout.c Tue Feb 27 17:36:35 2001
@@ -81,6 +81,7 @@
int bad_reg = -1;
CORE_ADDR reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */
int numregs = ARCH_NUM_REGS;
+ char *buf=alloca(MAX_REGISTER_RAW_SIZE);

/* If u.u_ar0 was an absolute address in the core file, relativize
it now,
so we can use it as an offset into core_reg_sect. When we're done,
@@ -93,12 +94,20 @@

for (regno = 0; regno < numregs; regno++)
{
- addr = CORE_REGISTER_ADDR (regno, reg_ptr);
- if (addr >= core_reg_size
-
&& bad_reg < 0)
-
bad_reg = regno;
+ if (CANNOT_FETCH_REGISTER (regno))
+
{
+
memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */
+
supply_register (regno, buf);
+
}
else
-
supply_register (regno, core_reg_sect + addr);
+
{
+
addr = CORE_REGISTER_ADDR (regno, reg_ptr);
+
if (addr >= core_reg_size
+
&& bad_reg < 0)
+
bad_reg = regno;
+
else
+
supply_register (regno, core_reg_sect + addr);
+
}
}

if (bad_reg >= 0)

Can you please expand on this change. I don't think it is s390 specific.

Andrew