Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Debugging Konsole

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
Ravi Joshi
Posts: 12
Joined: 2015-10-03 16:56
Has thanked: 3 times

Debugging Konsole

#1 Post by Ravi Joshi »

Can someone please enlighten how an application such as konsole is developed? I've got source, built it and generated deb file, but just don't know what environment/IDE to use it to debug.
I want to debug it since the pre-installed terminal crashes each time I close it. I am fairly conversant with C++, but only is Microsoft environment.
Thanks.

Code: Select all

Application: konsole (konsole), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#6  0x00007f3167bed1b3 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x00007f3167be35dd in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#8  0x00007f3167be3c79 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#9  0x00007f3167bd82ed in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#10 0x00007f3167bd8399 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#11 0x00007f3167527bc9 in __run_exit_handlers (status=0, listp=0x7f31678935a8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
#12 0x00007f3167527c15 in __GI_exit (status=<optimized out>) at exit.c:104
#13 0x00007f3167511b4c in __libc_start_main (main=0x400730 <main>, argc=1, argv=0x7ffca514dfb8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffca514dfa8) at libc-start.c:321
#14 0x000000000040075e in _start ()

tomazzi
Posts: 730
Joined: 2013-08-02 21:33

Re: Debugging Konsole

#2 Post by tomazzi »

You don't need to generate a deb package - it's completely pointless.

1. Get the sources, build the executable _in_debug_mode_ (-g option) *OR* download dbg version if available
2. Launch the executable
3. Connect the gdb to a to the process. (I prefer to use Code::Blocks here, as this IDE has a very nice and turbo-fast GDB-MI interface)
4. Close the application - see what have happened.
5. Set the break points in critical sections of code and repeat the action until You realize where is the problem.

Basically that's all, but:
It is possible, that it's some library code that is crashing, not the application itself. In such case You need to download dbg versions of libraries which were involved in the crash - in Your case that could be libQt5DBus.so for example.

Regards.

Edit:
... sometimes, when I'm getting lazy or simply don't have the time to analyse the code, then I just let Valgrind to find the problem for me ;)
Most of the crashes are caused by simple bugs wich are easily detected by valgrind or helgrind - so I think this could be the first step in debugging the code, especially when You are not going to develop the application but just want to find the bug.
/edit
Odi profanum vulgus

Ravi Joshi
Posts: 12
Joined: 2015-10-03 16:56
Has thanked: 3 times

Re: Debugging Konsole

#3 Post by Ravi Joshi »

Thanks Tom. I can attach the debugger now, but need to figure out how to configure path to source files etc.
In the meantime, is it possible to load the konsole project in Code::Blocks, as opposed to attaching the debugger?
Thanks in advance,
Ravi

tomazzi
Posts: 730
Joined: 2013-08-02 21:33

Re: Debugging Konsole

#4 Post by tomazzi »

Ravi Joshi wrote:In the meantime, is it possible to load the konsole project in Code::Blocks, as opposed to attaching the debugger?
Yes, there are 2 ways to do this:
1. Create a new project, and if there is a makefile for Konsole (there should be one), then You can tell the Code::Blocks to use it for compiling (Project properties)
2. You can just start a new project, add all the source files, set compiler flags, linker options and search directories etc.

In both cases, this will allow You to easily (re) compile the code and start the application in the debugger, which will be automatically configured (source paths, etc.)

By default, the project is recompiled before entering debugger, to assure consistency between sources and binary - this behaviour can be disabled in debugging options (if needed).

Regards.
Odi profanum vulgus

Post Reply