From 7b7cb45f7c1ed307b585ab3506dc57854ec076a6 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 30 Apr 2025 22:55:05 +0100 Subject: Add some useful info printouts to debug builds Specifically when building in debug mode, we now: * Display all features on load, including skipped and internal ones, sorted by internal name instead of display name. * Print the names of all matched gametype tags after the feature list. * Add an sst_dbg_getcmdcb command to get the address of a command callback for quick breakpoint insertion or Ghidra lookup. * Add an sst_dbg_sendtables command to dump out the full ServerClass tree to help get names for entprops.txt. Note: this output is very long so you'll likely need to log console output to a file to be able to read it all. There's a bunch of developer experience and debug help stuff I want to get done eventually. This is just a very small piece, but it's a start. --- src/build/mkentprops.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/build/mkentprops.c') diff --git a/src/build/mkentprops.c b/src/build/mkentprops.c index bd4b082..17d9aa0 100644 --- a/src/build/mkentprops.c +++ b/src/build/mkentprops.c @@ -368,6 +368,21 @@ _( " }") _( "}") } +static inline void dodbgdump(FILE *out) { +_( "static inline void dumpentprops() {") +_( " con_msg(\"-- entprops.txt --\\n\");") + for (int i = 0; i < ndecls; ++i) { + const char *s = sbase + decls[i]; +F( " if (has_%s) {", s); +F( " con_msg(\" [x] %s = %%d\\n\", %s);", s, s) +_( " }") +_( " else {") +F( " con_msg(\" [ ] %s\\n\");", s) +_( " }") + } +_( "}") +} + int OS_MAIN(int argc, os_char *argv[]) { if_cold (argc != 2) die(1, "wrong number of arguments"); int f = os_open_read(argv[1]); @@ -389,6 +404,13 @@ int OS_MAIN(int argc, os_char *argv[]) { if_cold (!out) die(100, "couldn't open entpropsinit.gen.h"); H(); doinit(out); + + // technically we don't need this header in release builds, but whatever. + out = fopen(".build/include/entpropsdbg.gen.h", "wb"); + if_cold (!out) die(100, "couldn't open entpropsdbg.gen.h"); + H(); + dodbgdump(out); + return 0; } -- cgit v1.2.3-54-g00ecf