Hello,
since I upgraded to Kubuntu 14.04 Geany is crashing whenever I try to use debugger. I am using it with c files (binaries). It worked just fine on Kubuntu 13.10
Steps I use to reproduce this:
Then the whole Geany application crashes.
I attached a log from valgrind to this ticket. I hope that can be helpful.
Hi! I've took a quick look, the reason the plugin crash is gdb 7.7 syntax (or behaviour) changes. In particular gdb MI -exec-run command do not accept "&" anymore, that was used to start target executable in async mode to enable for example inserting new break while a target is running. I tried to change debugger/src/dbm_gdb.c:372 from
exec_async_command("-exec-run &");
to
exec_async_command("-exec-run");
and it didn't crash, however not sure if async mode functionality is still enabled if doing so.
If you can patch and build - that's a hint, I'll take a closer look asap.
Having this change, geany crashes on starting debugging.
Console gives:
sys.excepthook is missing
lost sys.stderr
Changing the two occurrence of
"-exec-run &"to remove the&did fix the crash form me. I indeed am using GDB 7.7.1 (Debian unstable here).The potentially crashing code is still here, but it's not triggered anymore and the debugging session seems to work OK.
I think fixing Debugger to work with GDB 7.7 is important as it seems to have spread (Debian testing, Fedora 20, Ubuntu 14.04, …).
It would also be good to make the code more resistant to communications problems like this not to crash when such unexpected data is received.
Thanks for the quick answer, I was really surprised that you noticed it and replied so fast. After a while I managed to adjust the code as you suggested and compile it but it did not help unfortunately.
Affects me too
I think i have the same problem.
The erroneous code for me ist at dbm_gdb.c:584. strstr return NULL which is not evaluated. A memory dump gives me "^error,msg="Invalid argument: &" followed by 4xzero.
Just having a quick view over the file i saw more of this constellations.
Really poor coding...
I noticed that if you have any strings in your code or in data used by your code it still crashes hard - even if you change the code noted by Colomban...
In stree.c above line 510 I added a NULL check and edited gtk_tree_model_get() to have a -1 argument:
if(model == NULL) {
printf("model is null\n");
return;
}
gtk_tree_model_get(model, &thread_iter, S_THREAD_ID, &existing_thread_id, -1);
And in dbm_gdb.c @ 584 I did a NULL check - the free may not be necessary, but otherwise cleanup is skipped:
gchar *thread_id = strstr(line + strlen(line) + 1,"thread-id=\"");
if (thread_id == NULL){
g_free(line);
return FALSE;
}
Bug is fixed https://github.com/geany/geany-plugins
Fixed in 017b6bb91cef1f344cbe8f94828e19468cb2e074
Last edit: Colomban Wendling 2015-09-14