Found it, from 1996 :-)
TITLE 'CCREGS - REGISTERSTAENDE VON C AUS ERMITTELN'
*
**********************************************************************
**********************************************************************
**** ****
**** PROGRAMM: C C R E G S ****
**** PROGRAMMIERER: OPP ****
**** DATUM: 09.96 ****
**** ****
**** PROGRAMMBESCHREIBUNG: ****
**** ****
**** AKTUELLE REGISTERSTAENDE INNERHALB EINES ****
**** C-MODULS ERMITTELN ****
**** ****
**** DIE FUNKTION CCREGS ERHAELT ZWEI PARAMETER: ****
**** ****
**** - EINEN ZEIGER AUF EINEN VEKTOR AUS 16 ZEIGERN ****
**** FUER DIE AUFNAHME DER REGISTER 0 BIS 15 ****
**** ****
**** - EINEN ZEIGER AUF EINEN VEKTOR AUS 4 DOUBLES ****
**** FUER DIE GLEITKOMMAREGISTER 0, 2, 4 UND 6 ****
**** ****
**** C-DEKLARATION: int ccregs (void **, double *); ****
**** ****
**********************************************************************
**********************************************************************
*
CCREGS CSECT
*
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
RA EQU 10
RB EQU 11
RC EQU 12
RD EQU 13
RE EQU 14
RF EQU 15
*
USING CCREGS,RF
B WEITER UEBERSPRINGEN DER KENNUNG
DC AL1(23)
DC CL23'CCREGS /&SYSDATE/&SYSTIME'
*
WEITER DS 0H
STM RE,RC,12(RD) REGISTER SICHERN
LR RB,RF BASISREGISTER 11 SETZEN
DROP RF
USING CCREGS,RB
*
L R2,0(R1)
MVC 0(52,R2),20(RD) REGISTER 0 BIS 12 AUS SAVEAREA
ST RD,52(R2) REGISTER 13
MVC 56(8,R2),12(RD) REGISTER 14 UND 15 AUS SAVEAREA
*
L R2,4(R1)
STD 0,0(R2) GLEITKOMMAREGISTER NULL
STD 2,8(R2) BIS SECHS
STD 4,16(R2)
STD 6,24(R2)
*
LM RE,RC,12(RD) REGISTER ZURUECKLADEN
XR RF,RF
BR RE
*
END CCREGS
Am 05.04.2023 um 03:43 schrieb Bernd Oppolzer:
Am 04.04.2023 um 23:37 schrieb Charles Mills:
I just had a similar problem: "how do you determine your entry R0
from C?" I asked here and got no answer.
with native C, this is not possible IMO;
what I did: I wrote a (very small) ASSEMBLER routine which can be
called from everywhere and simply stores
the actual values of the registers 0 to 15 in a vector of 16 void
pointers passed by the C caller.
something like
extern void ccregs (void **regs);
void *regtable [16];
...
ccregs (regtable);
this way, you get - for example - regtable [13], which is the content
of GR 13 at the time of the ccregs call.
GR 13 points to the current save area a.k.a. stack frame. From this
save area, you can walk up to the
save area of the caller and find the registers at the time of the call
of the current function ... this can
all be done using C. It is, BTW, even possible to analyse the whole
save area chain this way,
including the names and addresses etc. of the surrounding stack
frames, and the entry point,
return addresses and so on ... a complete stack trace, if you want.
All this can be done during program run,
without interrupting or abending the current process or function.
Finding the R0 at the time of the call is very simple, once you have
the current R13.
HTH, kind regards
Bernd
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN