How to inspect zblorb/z8 file to see if it is in Debug?

Is there a quick way to do this, e.g. bytes we can look at, or a string we can search for in the file?

An executable would be nice but I’m looking for more “check for a sequence of bytes” so I could put it in a python script.

This is a relatively minor thing, but sometimes I’ve gotten confused why a test run misfires, and later I realize it’s because I had a release build (to send to testers, and it don’t have my programmer-testing commands) instead of a debug build.

Thanks!

1 Like

If you have a transcript, you can look for “SD” after the Inform version in the banner. It should look something like…

Story Title Here
Story Headline by Author Name
Release 0 / Serial number 221027 / Inform 7 build 6M62 (I6/v6.41 lib 6/12N) SD

Those last two letters mean that Inform 6 was run with the “strict” and “debugging” flags turned on. A release version won’t have those.

If you’re using this in an automated testing script, you can also insert a harmless debugging command and see if it succeeds or fails. SHOWHEAP, for example, prints a single line of memory usage statistics in a debug file but is not recognized in a release file.

There might be a way to detect it from the binary itself, but I don’t know of one.

2 Likes
$ echo "quit\ny"|dfrotz zcode.z8|egrep '6/12N\) SD$'

will output something like “Release 1 / Serial number 220127 / Inform 7 build 6M62 (I6/v6.36 lib 6/12N) SD” for the Debug case and return a non-0 exit code (and typically no output) in the Release case. Whether or not the echo "quit\ny" bit works as hoped depends on whether or not the game immediately offers a command prompt, of course.

And you could look for ShowHeap as @Draconis suggested by uploading the binary to glulx-strings (despite the name it’s a game polyglot).

2 Likes

True, you could extract the strings from the binary and look for “showheap” and the like. It’s highly unlikely that string would appear in a release file.

Of course, if it’s your own game, you could also put in a section not for release that says “THIS IS A DEBUG BUILD” in big letters when play begins.

2 Likes

This will help with the scripts … I can just type “SD$” as a regex to look for at the start.

Or with Zed’s script, I could just add a bunch of spaces to start, if I have a lot of introductory text.

Toastball is great, isn’t it?

I like TXD for Windows too on the command line but haven’t found anything equivalent for Linux.

Ha, I just noticed these bits in glulx-strings’ README.

[…] Thanks to Andrew Schultz for bringing this to my attention.
[…] Let’s see if Andrew Schultz can find any obvious problems with it…

1 Like

With txd installed, this is much better than talking to dfrotz:

txd zcode.z8|fgrep ShowHeap

and ztools can be built from source for Linux.

2 Likes

That was so long ago! Man, he was a good sport about it. I threw some tough requests at him, and he fixed them quickly. I’ve come to take it for granted.

What I really like is, it can be used locally, and I have a link to it from my local starter page.

Oh, wow, nice find! Yeah, this knocks things out. I’ll try and build things some day. I suspect the “no license” is inaccurate, but we might not want to upload anything to ifarchive until it’s filled in.