Partially resolves, or improves debugging for #1569.
In the future we could give better feedback to the user by showing a dialog or something. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1572
-- Commit Summary --
* Remove redundant SSM macros * Check Scintilla status in debug builds * Change all scintilla_send_message calls to use SSM macro * Improve Scintilla status messages output
-- File Changes --
M src/callbacks.c (2) M src/document.c (2) M src/editor.c (10) M src/highlighting.c (4) M src/keybindings.c (8) M src/printing.c (14) M src/sciwrappers.c (46) M src/sciwrappers.h (10) M src/search.c (4) M src/symbols.c (10)
-- Patch Links --
https://github.com/geany/geany/pull/1572.patch https://github.com/geany/geany/pull/1572.diff
@codebrainz nice.
This is going to need people with 32 bit systems to test, 64 bit systems will start swapping and get unusabley slow waaay before they fail allocation (found that when trying #1540 :)
A quick test built with msys2 32-bit gives this kind of output:
![sci-status-code](https://user-images.githubusercontent.com/181177/28954234-9cbe9598-7892-11e7...)
I'm not sure why it doesn't output ": memory is exhausted" at the end of the debug message. Maybe because it's freaking out due to no memory?
codebrainz commented on this pull request.
@@ -42,7 +42,51 @@
#include <string.h>
-#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l) +#ifndef NDEBUG +
FIXME: spurious line break
@codebrainz pushed 1 commit.
13d8d94 Fix message formatting string
The debug message is fixed in last commit, was using 64-bit instead of 32-bit placeholders in printf string. Also changed it to use a literal for the format string.
Now it's showing like this:
![sci-status-code2](https://user-images.githubusercontent.com/181177/28955342-de860f44-789a-11e7...)
Note that no public API is changed by this PR, so if similar checks are desired inside of plugins (core or otherwise) it should be done as a separate PR.
elextr commented on this pull request.
case SC_STATUS_BADALLOC:
+ sub_msg = "memory is exhausted"; + break; + case SC_STATUS_WARN_REGEX: + sub_msg = "regular expression is invalid"; + break; + default: + if (status >= SC_STATUS_WARN_START) + sub_msg = "unknown warning"; + else + sub_msg = "unknown failure"; + break; + } +#define SCI_STATUS_FORMAT_STRING "%s:%u: scintilla has non-zero status " \ + "code '%d' after sending message '%u' to instance '%p' with " \ + "wParam='%lu' and lParam='%ld': %s"
Theoretically these formats should be `%p` because both wparam and lparam are `intptr_t`. In reality they are the same size as long on all platforms except win64, and we don't currently support that AFAIK.
elextr approved this pull request.
LGBI
Merged #1572.
Feel free to revert if it borks non Windows non 32-bit builds.
github-comments@lists.geany.org