Compiler's -g3 switch removed?

The Inform Technical Manual section 13.4(xiii) ("Changes made between v6.20a and v6.21") lists as one of its items:

The "-g" switch for tracing function calls now has a third setting,
    "-g3", which traces even veneer calls: the "-g2" setting now traces
    game and library calls but not veneer calls.

This switch does not appear to function in version 6.31 or later. Was it intentionally removed at some point?

I don’t think there’s anyone still on the forum who was active on compiler development before release 6.30.

Well, everyone known that, being an historian by trade & training, I attempt to track “The life and times of Inform and its library” (cit.), but in this case (and others noted) I think that we must use Jedi powers (“use the Source, Luke” :wink: ) and indeed, luckly, we have 6.20 (but not 6.20a) 6.21 and 6.3x sources around.

Best regards from Italy,
dott. Piergiorgio.

The technical manual just seems to be wrong on this: looking at the source code for Inform 6.21 shows that only ‘g1’ and ‘g2’ are valid options, there is no ‘g3’. It is hard to know what happened here, possibly this was a planned feature that was never released.

1 Like

Good suggestion. I looked over the 6.21 source, and there’s a little more to the story here.

In the 6.21 source, the inform.c section controlling switch interpretation uses the value to set an internal variable called trace_fns_setting. The accepted switch settings are only 0, 1, or 2, and trace_fns_setting is set to whatever numeric value is provided. (In the case of 0, no action is taken, so it is left in its uninitialized state.)

There are also places in syntax.c and veneer.c where the condition trace_fns_setting==3 is checked, which look like they should have an effect. So I think it was an implemented feature for which the appropriate switch handling was overlooked.

@DavidK, any chance that this could be addressed in 6.35?

Is this a feature you plan to use?

Only when I have to! For example, I could have used it yesterday when trying to figure out what’s going on with that order sensitivity problem. I needed a very indirect method to work out the transitions to veneer routines.

Okay, thanks. It’s good to have real-world use cases when we’re considering this stuff.

A quick check confirms what I suspected: -g2 isn’t really usable in Glulx, because it winds up trying to print debug info before the output windows are opened. -g3 will certainly do that too.

(But if you really need to do this, cheapglk+glulx will run the game and show the debug output without crashing.)

Too bad. For anyone working in Z-machine instead of Glulx, I made a modification to 6.34 to enable this switch, and it seems to do exactly as promised in the description in ITM 13.4. See attached patch for inform.c.

inform.c.enable-g3.patch.txt (1.3 KB)

I don’t think enabling it will make anything particularly worse for Glulx users, since it suffers the same issues there as -g2 (which is enabled).

If you wanted to put that on github as a pull request, it would make David’s life slightly easier.

(I realize that figuring out github and pull requests is not entirely trivial, so don’t feel obligated to learn just for the sake of a three-line patch.)