Tricking pl1's production_table



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
.



Relevant Pages

  • Re: copymemory basic question
    ... I have used that technique before; that is, put a MessageBox in a VC program ... workspace and then debug the program without using the MessageBox or MsgBox. ... > - Compile and save. ... not able to show anything due to the optimization. ...
    (microsoft.public.vb.winapi)
  • Re: when to use variable vs. constant?
    ... I have no idea what weight to give that optimization. ... It's not rally as simple as it sounds: substitution is always being ... whether the substitution happens at compile time or run time. ... DEBUG = 0' at the beginning of programs. ...
    (perl.beginners)
  • Re: Debug Vs Release
    ... > If I compile that code in debug mode then dissassemble the EXE, ... > private static void Main(stringargs) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: debugging in release mode
    ... I have no doubt that it's a problem of mine and not of the compiler. ... I don't really need optimization ... for the sake of memory space or execution speed. ... shows the differences between the default debug mode and the default release ...
    (microsoft.public.vc.mfc)
  • Re: converting some autogenerated ruby code to C
    ... faster than the pure Ruby version. ... I'm wondering how much optimization has been done there. ... def test ... You would either have to generate and compile and load a C extension for _each_ call of *eval or somehow collect all the code to eval and do it all at once. ...
    (comp.lang.ruby)