|
From: | Peter Bex |
Subject: | [Chicken-hackers] [PATCH] Add aggressive debugging checks to squash those damn bugs |
Date: | Sun, 29 Sep 2013 22:46:25 +0200 |
User-agent: | Mutt/1.4.2.3i |
Hello all, As some may (or may not...) have noticed, everything is completely fucked up: people are getting random errors (#1041, #1045) and a shitload of eggs is no longer being properly tested on Salmonella due to random untraceable breakage in henrietta-cache at Alaric's machine (which for some odd reason does not happen on the call-cc server). This has been going on for almost a week now, and it calls for some serious debugging! Attached are some patches: The first patch adds assertions to all the type accessors like C_unfix, C_block_{header,item}, C_character_code etc. It does this through a "check" macro which contains a horrible, evil hack which allows LET-like semantics in C macros, in a bit of a manual way. If you'd like more info, let me know and I'll try to clarify. Also, if anyone knows of a way to do this in a less verbose, ugly way, please let me know! The patch also cleans up a few unused macros and ensures all macros nicely use the C_(set)_block_item, C_block_header and C_data_pointer to access the C_SCHEME_BLOCK objects. This cleans up things a bit (and in this case, ensures the assertions are triggered when things are wrong). The rest of the patches are fixes for the few broken things I've already found by running "make check" and one or two egg tests on an instrumented version of CHICKEN: - The second patch fixes a subtle problem with the way CHICKEN_initialize calls C_randomize; the latter expects a fixnum but it's invoked with an unboxed C integer. This will error out every 2 seconds (on odd seconds, it will carry on because these look like boxed fixnums at the bit level) - The third patch fixes several fuckups in the reader related to EOF being treated as if it were a character (and then indexing into various vectors and shit like that). I think this may be a fix for the bugs Alaric has been running into with henrietta-cache (but I'm not 100% sure yet). Don't be afraid; the patch is a lot of lines, but mostly reindenting caused by a change of a 2-way IF to a 3-way COND. ediff can highlight the non-whitespace changes sanely. - The fourth patch is another subtle thing which may cause corruption in some programs using read-string!, but I doubt this has been encountered much in practice because it's 100% reproducible and will cause the exact same corruption every time: it'll insert a NUL byte at the start of the string buffer passed to read-string!. I've added some tests, because it's actually observable. I know the first patch is pretty large and ugly as hell, but considering how much this has already found (the above bugs and a bug in the numbers egg's type DB), I think it's worth embedding this into every DEBUGBUILD. It should also help if all Salmonella instances run this, as it will help us pinpoint more hard-to-find bugs. Of course it will slow down DEBUGBUILD CHICKENs even more (noticably), but generally a DEBUGBUILD isn't really built for speed, so it shouldn't matter so much. Cheers, Peter -- http://www.more-magic.net
0001-In-DEBUGBUILDs-add-sanity-assertions-to-most-importa.patch
Description: Text document
0002-Fix-CHICKEN_initialize-s-call-to-C_randomize-which-e.patch
Description: Text document
0003-Fix-several-subtle-problems-in-the-reader-caused-by-.patch
Description: Text document
0004-Fix-read-string-behaviour-after-peeking-at-EOF-add-r.patch
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |