Tricking pl1's production_table
- From: Jay Levitt <jay+news@xxxxxx>
- Date: Thu, 25 Oct 2007 22:06:24 -0400
Most of our site's code is compiled with -production_table, optimization
level 2.
I'm finding that it would be useful to have some functions that are always
available from the debugger. For instance, I have a function dbg$date()
that simply returns the current date and time. That can be very handy if
you're using debug and break statements to create a trace log.
Luckily, there's a 'standards' include file that nearly every source file
includes. So I added to standards.incl.pl1:
declare dbg$date entry returns char(32)var;
And I recompiled a few source files, such as this one:
%include 'standards';
testprog: procedure options (main);
put skip list ('hello, world.');
put skip list ('this line is a great place to set a breakpoint.');
end testprog;
debug testprog
db? break 6 (d dbg$date();cont)
debug: dbg$date not found.
db?
Oops! Naturally, -production_table sees that testprog.pl1 doesn't call
dbg$date, so it's not in its symbol table. I can do
db? break 6 (env dbg$date;d dbg$date();env testprog;cont)
But that's ugly and painful.
Is there a way to fool pl1 into thinking that dbg$date is referenced in the
current file? I was thinking of adding some type of stub routine to
standards.incl.pl1, e.g.:
never_called: procedure;
put skip dbg$date();
end never_called;
but of course all the object modules would then have a definition for
never_called, and the binder would complain. And there don't seem to be
any ways to (a) create a procedure with "file" scope so that it won't be
seen by the binder, or (b) create a procedure with a unique name per file
(e.g. $FILE$LINE_never_called: procedure).
I think there's probably not a way to do this, but can anyone think of any
cleverness? Unfortunately, I can't just go compile everything with -table
when debugging; there are a bunch of routines that incorrectly rely on
boolean short-circuiting, which doesn't happen below optimization level 2.
--
Jay Levitt |
Boston, MA | My character doesn't like it when they
Faster: jay at jay dot fm | cry or shout or hit.
http://www.jay.fm | - Kristoffer
.
- Follow-Ups:
- Re: Tricking pl1's production_table
- From: Paul Green
- Re: Tricking pl1's production_table
- Prev by Date: Re: IS:: Can I &attach_input from PL/I?
- Next by Date: Re: IS:: Tricking pl1's production_table
- Previous by thread: Re: IS:: Can I &attach_input from PL/I?
- Next by thread: Re: Tricking pl1's production_table
- Index(es):
Relevant Pages
|