Education Project/Effort/Math baseline alignment/Debuging starmath

From Apache OpenOffice Wiki
Jump to: navigation, search

Milestone

Current Build is m245

install it wherever ( Desktop is a good option on Mac OS X)


Debug

all libmath are stripped by default, and you'll have to add the symbols for debugging. Thus you'll have to rebuild starmath, and symlink with the new math libs.

Note: since sb71 integration, use symlinks with libs is just a workaround. See [issue 83548 for more information ]

Process

1) Build adding rectangles (for baselines and co )

-> uncomment line 93 in node.cxx : all formulas will be drawn with colored lines giving all alignment information ( Top Bottom Baseline when existing ..etc ) -> See the screenshots below

2) Build starmath again using :

cd starmath

mv unxmacxi.pro unxmacxi.pro_backup /* adapt to your architecture / OS */ build, debug="something_but_not_empty"


3) Link the new libs ( or use linkoo ) from inside the bundle :

3.1) cd ~/Desktop/test_print/OpenOffice.org 2.4.app/Contents/MacOS

3.2 remove the striped libs :

rm -f libsm680mxi.dylib libsmd680mxi.dylib

3.3 create symlinks for the non strippied one :

ln -s ~/Desktop/SRC680_m245/starmath/unxmacxi.pro/lib/libsm680mxi.dylib . ln -s ~/Desktop/SRC680_m245/starmath/unxmacxi.pro/lib/libsmd680mxi.dylib .

!! don't forget the points !!


4) run gdb (from the previous location, inside the bundle) :

gdb --args soffice.bin - ( the " - " will open a new empty Writer document )

Interesting breakpoints

SmRectangleNode::Arrange ( starmath/source/node.cxx, line 2329 )

SmSubSupNode::Arrange ( starmath/source/node.cxx, line 1437 )

SmMathSymbolNode::Arrange ( starmath/source/node.cxx, line 2731 )

SmBinVerNode::Arrange ( starmath/source/node.cxx, line 1087 )

gdb completion

As preliminary, don't forget to use gdb completion feature: it's great and very usefull when you have to choose between several possibilities, like the same but overloaded method ... etc.

Principle: write the first letters of the word you want to write, and when sure, hit TAB key ( hit it several times if needed )

- either there is only one solution, and the word will be simply completed (nice, isn't it ? ) - or several solution will be proposed, and you'll have to decide which one use ..


How add breakpoints

Several possibilities can be used there :

1) specify the line :

Insert a breakpoint line 1234 in node.cxx :

(gdb) b node.cxx:1234


2) specify the method:

Insert a breakpoint when a method is called :

(gdb) b 'SmBinVerNode::Arrange'

Note: when the same method is overloaded, you can add the arguments to be sure to hit the right method.


3) conditional break :


Insert a breakpoint when the condition is verified :

(gdb) b cond ( (thing == true) || (foo != 0) )


First try:

type an equation containing a^2 + b^2 , exit formula ( ESC twice ) then enter the word "text"

then create a new equation containing  %tau a^2 + b^2 and notice the difference.


First breakpoint: parse.cxx:398

When entering whatever letter, you hit a breakpoint. Just trace after it, and compare the two equations (e.g.)

Entering  %tau a^2 + b^2 , you'll see the line starmath/source/parse.cxx:770


  • FIXME* : verify what makes ( if (aTmpRes.TokenType & KParseType::IDENTNAME)) true

Screeenshots

Issue972 tested case05.jpg

Issue972 tested case21.jpg

Personal tools