Posts

Showing posts from June, 2018

Fixup changes in patches using fixup

While your changes are in the local repository you can  make commit one on top of another and then merge them using git rebase git rebase --interactive HEAD~2  But once pushed we want to ammend the previous commit using fixups using git commit --fixup commitID git rebase -i --autosquash master

Debugging LibreOffice with GDB

Getting started To debug LibreOffice with GDB you need to build LibreOffice with debug symbols. You can either choose to build LO with symbols for the entire project or for selected modules. For building with symbols for the entire project you can use ./autogen.sh --enable-debug For building  with symbols for specific modules ./autogen.sh --enable-debug --enable-selective-debuginfo = "sc/"   More information for setting up GDB can be found here How to debug . Setting up pretty printers Basics Debugging boils down to the following set of actions: Set up a break point Run the program Step through the code Analyze the variables as you go Handling Crashes while debugging The most common reasons for crashes are either an exception occurred or an assertion failures. In case of Exceptions, you can stop GDB at the point where the exception occurred by setting up a breakpoint using catch throw and then analyze the backtrace (generated using bt )....

Speeding things up

I work on an Ubuntu machine with 4GB RAM and Intel i5 processor. Every time I perform a build or run the debugger, the entire system slows down to a crawl making development slow and tedious. Hence I started looking for ways to speed up my system and came across LXDE desktop environment. Being lightweight, it consumes very less system resources. I was amazed at the performance boost I experienced and it sped up my code, build, debug cycle. If you are experiencing difficulties due to a slow system, I recommend switching to either LXDE desktop or using LUbuntu which comes natively with LXDE.

Launching a unit test for debugging in GDB

While building a new feature it is a good idea to test it with the help of unit tests. But it may also happen that the feature is not yet linked to the UI and you have no way to debug it. I tried to work around this problem by trying to use the unit test to gain entry to the code and set breakpoints there. In LibreOffice we can launch a unit test in gdb by make <name of the makefile of the unit test> CPPUNITTRACE="gdb --args" e.g. make CppunitTest_sc_dataprovider CPPUNITTRACE="gdb --args"   Then you can set breakpoints in gdb and then run.