Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!lsuc!dave From: dave@lsuc.UUCP Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: who called a C routine - get it from the stack frame Message-ID: <1459@lsuc.UUCP> Date: Tue, 16-Dec-86 09:45:49 EST Article-I.D.: lsuc.1459 Posted: Tue Dec 16 09:45:49 1986 Date-Received: Wed, 17-Dec-86 07:00:35 EST Reply-To: dave@lsuc.UUCP (David Sherman) Organization: Law Society of Upper Canada, Toronto Lines: 20 Summary: code for v6 on PDP-11/45 Xref: lsuc comp.lang.c:394 comp.unix.wizards:336 I just came across this code I wrote 5 years ago on a PDP-11/45 running v6: / returns the address of the caller's return pointer .globl _pcret _pcret: mov 2(r5),r0 / pc of caller of caller rts pc Looking back at the application, I see now that doing it this way was silly as well as non-portable. I wanted a function to do different things depending on which function called it. Much better just to pass that information as an argument. However, if anyone out there has a PDP-11 running v6, this might work. Call it pcret.s and invoke it as pcret(), of course. David Sherman Toronto -- { ihnp4!utzoo seismo!mnetor utai watmath decvax!utcsri } !lsuc!dave