jcreedcmu / twelf-mac

Other
0 stars 1 forks source link

Make debugging logging more systematic #12

Closed jcreedcmu closed 5 months ago

jcreedcmu commented 6 months ago

Background

Right now I'm relying on

  stdout = stderr = fopen("out", "w");
  setbuf(stdout, NULL);
  setbuf(stderr, NULL);

and printf.

@agoode noticed some suspicious file corruption: image which shows some printf messages (Hello, World, Ok, we have a docTE) apparently creeping into .elf files, even those that weren't actually Saved from Twelf, just Opened. Conceivably this is because of some streams getting unintentionally mixed. Note however, that these messages don't occur in the current version of the Twelf app (as of e16467f), but did in older versions.

Another theory is "double close" corruption: Inside Macintosh warns:

Attempting to close the same file twice may result in loss of data on a volume

Steps to Reproduce

No known reliable repro yet.

Action

Might be nicer to make a proper logfile with mac toolbox file calls, just to decrease the confusing use of multiple file APIs.

jcreedcmu commented 5 months ago

No longer using printf, debug log window available within the program.