Dear all,
I am currently trying to create a custom lexer for a language called NESTML https://github.com/nest/nestml. I followed the instructions on the hacking section of the manual http://geany.org/manual/dev/hacking.html#syntax-highlighting and managed to compile a local geany with the new lexer.
However, I am encountering a Segfault problem when using this local geany: when I directly open a file, geany crashes immediately with a segmentation fault message. However, if I use Document > define filetype > NESTML on an empty page, I am able to write a file and the new lexer seems to work like a charm. Following this, opening an existing .nestml file becomes possible and the lexer still works on this file. Yet, when I close geany, I again get the segmentation fault. At some point (not always)s messages also appeared, saying: (geany:10608): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
The detailed of my implementation is on my fork of geany, on GitHub https://github.com/Silmathoron/geany. I am working on an Ubuntu-based Linux Mint with Glib2 and Gtk2, and the latest master for geany; the compilation was done using:
(make distclean &&) ./autogen.sh --disable-html-docs --prefix=/home/me/.local && make && make install
and the output of autoconf is attached.
Could someone tell me where the problem comes from? I first thought I forgot to tell geany something about the lexer, but since the crash occurs for any filetype, I'm no longer sure this is the problem. An since my knowledge in C++ development is limited, I don't know how I could build geany in debug mode to track the problem...
Any help appreciated!
Best regards,
Tanguy
On 2016-12-17 01:14 PM, Fardet Tanguy wrote:
[...]
Could someone tell me where the problem comes from? I first thought I forgot to tell geany something about the lexer, but since the crash occurs for any filetype, I'm no longer sure this is the problem. An since my knowledge in C++ development is limited, I don't know how I could build geany in debug mode to track the problem...
Hi,
Can you give a GDB backtrace as described here under "Getting a backtrace":
http://www.geany.org/Support/Bugs
And to make sure `https://github.com/Silmathoron/geany%60 is up to date with the debugged build.
Regards, Matthew Brush
Hi Matthew,
thanks for your reply!
I did some modifications on the lexer since yesterday, so I ran gdb on both commits just to show that it's not related.
As a note, when I open geany with existing pages in the geany.conf file, the pages are correctly loaded at startup, it seems to be only the process following the popup window for open (after I chose the file and clicked "open") which triggers the segfault, as well as exiting geany.
I'm using Cinnamon 3.07 on LinuxMint 18 64-bit, with kernel 4.4.0-53 and GTK 2.24.30, GLib 2.48.1 Hope this helps,
Best. TF
Le 18/12/2016 à 04:24, Matthew Brush a écrit :
On 2016-12-17 01:14 PM, Fardet Tanguy wrote:
[...]
Could someone tell me where the problem comes from? I first thought I forgot to tell geany something about the lexer, but since the crash occurs for any filetype, I'm no longer sure this is the problem. An since my knowledge in C++ development is limited, I don't know how I could build geany in debug mode to track the problem...
Hi,
Can you give a GDB backtrace as described here under "Getting a backtrace":
http://www.geany.org/Support/Bugs
And to make sure `https://github.com/Silmathoron/geany%60 is up to date with the debugged build.
Regards, Matthew Brush
Your two backtraces show different things, the -old one indeed shows a crash during document open, inside scintilla but to do with closing the blank page in the notebook before opening your file. The crash is in libgail which (IIUC) is used in ATK the accessibility technology for which there were some new additions to scintilla recently.
The -new backtrace shows a crash while shutting down Geany, not opening a file, but again in libgail while closing a notebook tab.
These may not be related to your lexer, you are just "lucky" to manage to cause the problem to occur. Hopefully the ATK expert will be in touch if thats the cause since (presumably) this doesn't happen with his system.
Cheers Lex
PS I'm using the same system as you, but running a GTK3 build of Geany.
On 18 December 2016 at 18:36, Fardet Tanguy fardet.tanguy@laposte.net wrote:
Hi Matthew,
thanks for your reply!
I did some modifications on the lexer since yesterday, so I ran gdb on both commits just to show that it's not related.
As a note, when I open geany with existing pages in the geany.conf file, the pages are correctly loaded at startup, it seems to be only the process following the popup window for open (after I chose the file and clicked "open") which triggers the segfault, as well as exiting geany.
I'm using Cinnamon 3.07 on LinuxMint 18 64-bit, with kernel 4.4.0-53 and GTK 2.24.30, GLib 2.48.1 Hope this helps,
Best. TF
Le 18/12/2016 à 04:24, Matthew Brush a écrit :
On 2016-12-17 01:14 PM, Fardet Tanguy wrote:
[...]
Could someone tell me where the problem comes from? I first thought I forgot to tell geany something about the lexer, but since the crash occurs for any filetype, I'm no longer sure this is the problem. An since my knowledge in C++ development is limited, I don't know how I could build geany in debug mode to track the problem...
Hi,
Can you give a GDB backtrace as described here under "Getting a backtrace":
http://www.geany.org/Support/Bugs
And to make sure `https://github.com/Silmathoron/geany%60 is up to date with the debugged build.
Regards, Matthew Brush
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Hi,
Le 18/12/2016 à 10:00, Lex Trotman a écrit :
Your two backtraces show different things, the -old one indeed shows a crash during document open, inside scintilla but to do with closing the blank page in the notebook before opening your file.
Well they both lead to remove_page(), destroying a ScintillaObject and downhill from there, so I guess it's tightly related even though the trace is slightly different
The crash is in libgail which (IIUC) is used in ATK the accessibility technology for which there were some new additions to scintilla recently.
The -new backtrace shows a crash while shutting down Geany, not opening a file, but again in libgail while closing a notebook tab.
These may not be related to your lexer, you are just "lucky" to manage to cause the problem to occur. Hopefully the ATK expert will be in touch if thats the cause since (presumably) this doesn't happen with his system.
Yeah, actually I guess I know where it comes from, see https://groups.google.com/d/msg/scintilla-interest/uFysitczmag/qjZ30KN_BwAJ
As said however I didn't see no problem here, neither crashes nor Valgrind complaining, but maybe I'm lucky or something. I'll try and come up with a patch later today, so if that's the reason of the crash Fardet could tell me :)
On 18 December 2016 at 18:36, Fardet Tanguy fardet.tanguy@laposte.net wrote:
Hi Matthew,
thanks for your reply!
I did some modifications on the lexer since yesterday, so I ran gdb on both commits just to show that it's not related.
Unfortunately those backtraces don't show enough information for good debugging as is, because of missing debugging symbols for GLib, GTK2 and GAIL. Could you please install the -dbg package for those and re-submit the backtrace? One is enough I think, as they both end up in remove_page() and likely the same bunch of stuff after that.
Cheers, Colomban
Hi,
Le 18/12/2016 à 10:42, Colomban Wendling a écrit :
Yeah, actually I guess I know where it comes from, see https://groups.google.com/d/msg/scintilla-interest/uFysitczmag/qjZ30KN_BwAJ
As said however I didn't see no problem here, neither crashes nor Valgrind complaining, but maybe I'm lucky or something. I'll try and come up with a patch later today, so if that's the reason of the crash Fardet could tell me :)
Lex tells me it works for him, but could you try http://pastebin.geany.org/Zbxo1/ please? It definitely theoretically fix something that could definitely it.
Cheers, Colomban
Le 18/12/2016 à 11:52, Colomban Wendling a écrit :
Hi,
Le 18/12/2016 à 10:42, Colomban Wendling a écrit :
Yeah, actually I guess I know where it comes from, see https://groups.google.com/d/msg/scintilla-interest/uFysitczmag/qjZ30KN_BwAJ
As said however I didn't see no problem here, neither crashes nor Valgrind complaining, but maybe I'm lucky or something. I'll try and come up with a patch later today, so if that's the reason of the crash Fardet could tell me :)
Lex tells me it works for him, but could you try http://pastebin.geany.org/Zbxo1/ please? It definitely theoretically fix something that could definitely it.
Submitted to Scintilla along with other AT stuff in https://groups.google.com/forum/#!topic/scintilla-interest/F0qZxZxhAEg
Regards, Colomban
Hi all,
very sorry for the late reply, I just realized all your answers except @MatthewBrush went down my spam folder, which is not updated automatically...
@Colomban: thanks, the fix worked! I still get the (geany:27364): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed error, but the segmentation fault no longer occurs.
Cheers! Tanguy
Le 18/12/2016 à 17:21, Colomban Wendling a écrit :
Le 18/12/2016 à 11:52, Colomban Wendling a écrit :
Hi,
Le 18/12/2016 à 10:42, Colomban Wendling a écrit :
Yeah, actually I guess I know where it comes from, see https://groups.google.com/d/msg/scintilla-interest/uFysitczmag/qjZ30KN_BwAJ
As said however I didn't see no problem here, neither crashes nor Valgrind complaining, but maybe I'm lucky or something. I'll try and come up with a patch later today, so if that's the reason of the crash Fardet could tell me :)
Lex tells me it works for him, but could you try http://pastebin.geany.org/Zbxo1/ please? It definitely theoretically fix something that could definitely it.
Submitted to Scintilla along with other AT stuff in https://groups.google.com/forum/#!topic/scintilla-interest/F0qZxZxhAEg
Regards, Colomban
Dear all,
now that the segfault problem http://lists.geany.org/pipermail/users/2016-December/010159.html is out of the way, I am still struggling with one point regarding the custom lexer https://github.com/Silmathoron/geany I created: the auto-ident behaviour.
The syntax of NESTML is very similar to that of Python (you can see a screenshot here https://github.com/nest/nestml/issues/303#issuecomment-267830820) so I would like to make Geany increase the indent after a column, and decrease it again after the keyword "end".
Because I thought it would be related, I managed to declare the folding procedure to recognize the column/end blocks; however, the indent still is not increased. Similarly, I found a get_python_indent method https://github.com/geany/geany/blob/2a2ae728341d12b7cea29b671beb08e441f62d95/src/editor.c#L1414 in src/editor.c with a comment saying /* add extra indentation for Python after colon */, but adding a condition to also recognize SCE_NESTML_OPERATOR did not solve the problem (and I can't find where this function is called anyway).
Could you tell me where auto-indent instructions are declared in Geany? Or is it something missing with the lexer?
Best, Tanguy
On 19 December 2016 at 23:44, Fardet Tanguy fardet.tanguy@laposte.net wrote:
Dear all,
now that the segfault problem is out of the way, I am still struggling with one point regarding the custom lexer I created: the auto-ident behaviour.
The syntax of NESTML is very similar to that of Python (you can see a screenshot here) so I would like to make Geany increase the indent after a column, and decrease it again after the keyword "end".
Because I thought it would be related, I managed to declare the folding procedure to recognize the column/end blocks; however, the indent still is not increased. Similarly, I found a get_python_indent method in src/editor.c with a comment saying /* add extra indentation for Python after colon */, but adding a condition to also recognize SCE_NESTML_OPERATOR did not solve the problem (and I can't find where this function is called anyway).
Could you tell me where auto-indent instructions are declared in Geany? Or is it something missing with the lexer?
Its nothing to do with the lexer. Sadly someone in the past made the lousy decision to hard code it, so there is no way to change it other than changing the hard coding.
Best, Tanguy
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Hi Lex,
Le 21/12/2016 à 02:53, Lex Trotman a écrit :
Could you tell me where auto-indent instructions are declared in Geany? Or is it something missing with the lexer?
Its nothing to do with the lexer. Sadly someone in the past made the lousy decision to hard code it, so there is no way to change it other than changing the hard coding.
Ok, good to know, could you point me to the place where the hard coding takes place, then? I'll hammer it in myself ;)
Best, Tanguy
Not really enough information, but if you want a guess, the most likely is an uninitialised variable in the lexer setup. This is indicated by the fact that it works if the setup is initiated one way (define filetype) vs another way (load file of filetype).
Cheers Lex
On 18 December 2016 at 07:14, Fardet Tanguy fardet.tanguy@laposte.net wrote:
Dear all,
I am currently trying to create a custom lexer for a language called NESTML. I followed the instructions on the hacking section of the manual and managed to compile a local geany with the new lexer.
However, I am encountering a Segfault problem when using this local geany: when I directly open a file, geany crashes immediately with a segmentation fault message. However, if I use Document > define filetype > NESTML on an empty page, I am able to write a file and the new lexer seems to work like a charm. Following this, opening an existing .nestml file becomes possible and the lexer still works on this file. Yet, when I close geany, I again get the segmentation fault. At some point (not always)s messages also appeared, saying: (geany:10608): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
The detailed of my implementation is on my fork of geany, on GitHub. I am working on an Ubuntu-based Linux Mint with Glib2 and Gtk2, and the latest master for geany; the compilation was done using:
(make distclean &&) ./autogen.sh --disable-html-docs
--prefix=/home/me/.local && make && make install
and the output of autoconf is attached.
Could someone tell me where the problem comes from? I first thought I forgot to tell geany something about the lexer, but since the crash occurs for any filetype, I'm no longer sure this is the problem. An since my knowledge in C++ development is limited, I don't know how I could build geany in debug mode to track the problem...
Any help appreciated!
Best regards,
Tanguy
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users