Debug OpenOffice.org using MS Visual Studio .NET 2003

On 2007/04/14, in OpenOffice.org, by ioriy2k


1. Overview

Windows에서 cygwin으로 build를 마친 OpenOffice.org source를 가지고 debugging하는 방법을 설명한다.

  • Build된 source에서 debug할 module을 찾아서 debug mode로 compile한 후 설치한다.
  • Debug를 위한 VS project를 생성하고 설정한다.
  • OpenOffice.org를 실행한 후 debugging한다.

2. Build a module of debug mode

예를 들기 위하여 아래와 같이 가정한다.

  • Source directory : $SRC_ROOT (ex. /cygdrive/d/Source/OOB680_m5)
  • Binary Install Directory : $INSTALL_DIR (ex. /cygdrive/c/Program Files/OpenOffice.org 2.0/program)

1. Debugging할 code의 위치를 알기 위해서 OpenOffice Cross Reference에서 검색한다. OpenOffice Cross Reference에서는 소스에서 사용자가 원하는 정보를 검색하기 용이하도록 Text, File Name, Identifier Search를 제공하고 있다.

2. 원하는 code의 위치를 찾았으면, Cygwin shell을 실행하고 source가 위치하고 있는 module로 이동한다.

1
2
3
4
~ $ cd $SRC_ROOT
$SRC_ROOT $ tcsh
$SRC_ROOT $ source winenv.set
(build를 위한 환경변수를 설정해 주기 위해서 실행한다.)

3. 다음과 같이 debug 모드로 build한다.

1
2
$SRC_ROOT/{module name} $ rm -rf wntmsci10.pro
$SRC_ROOT/{module name} $ build debug=true

4. Build된 module의 DLL과 debug symbol인 PDB file을 binary가 설치된 directory로 복사한다.
(Build된 module은 {module name}/wntmsci10.pro/bin에 존재한다.)

1
$SRC_ROOT/{module name} $ cp wntmsci10.pro/bin/*.dll wntmsci10.pro/bin/*.pdb $INSTALL_DIR

3. Create a debug project

이제 Visual Studio에서 debugg를 위해 사용할 project를 생성해야한다. 생성하는 방법은 다음과 같다.

OpenOffice.org debug project of VS .NET 2003 #1

1. Visual Studio를 실행한 다음 File -> Open -> Projects 메뉴를 선택하고 OpenOffice.org가 설치된 directory의 Programs\soffice.exe를 선택한다. 실제 OpenOffice.org의 실행파일은 soffice.bin이지만 Visual Studio에서 soffice.bin으로 project를 만들면 실행할 수 없다라고 error를 발생시키기 때문에 soffice.exe로 project를 만들도록 한다.

OpenOffice.org debug project of VS .NET 2003 #2

2. Project solution의 속성 dialog에서 source file 경로로 build한 OpenOffice.org의 source directory를 추가한다. 이렇게 하면 debugging 시에 debug mode로 compile 된 module이라면 code를 찾아서 표시해 준다.

OpenOffice.org debug project of VS .NET 2003 #3

3. Proejct solution의 속성 dialog에서 symbol file의 경로로 “OpenOffice.org가 설치된 directory\Programs”를 설정한다. Debug mode로 compile한 module의 *.pdb file을 위의 경로에 복사하면 debug symbol을 찾아서 VS에 표시해 준다.

OpenOffice.org debug project of VS .NET 2003 #4

4. soffice.exe project의 속성 dialog에서 작업의 명령을 soffice.exe에서 soffice.bin으로 변경한다. 위에서 언급한 대로 실제 실행되는 파일은 soffice.bin이다.

이렇게 만들어진 project를 저장하면 OpenOffice.org를 debug할 준비가 모두 끝나게 된다.

4. Debug

1. OpenOffice.org를 실행하면서 debugging하기

Debug OpenOffice.org #1-1

1) 위에서 만든 project를 열고 debugging할 source file을 연 다음 원하는 곳에 break point를 찍는다.

Debug OpenOffice.org #1-2

2) VS에서 program을 실행시킨다. Debug 할 module이 memory에 load되면 debugging이 가능하다. 나머지는 Visual Studio IDE 사용법과 같으니까 굳이 설명할 필요는 없을 것이다. 지금 이 그림은 OpenOffice.org 를 실행시켜 debugging하고 있는 모습이다.

2. 이미 실행되고 있는 OpenOffice.org를 debugging하기

Debug OpenOffice.org #2-1

1) 실행되고 있는 OpenOffice.org process를 VS debugger에 연결하기 위해 위에서 만든 project를 열고, Debug -> Process를 실행한다. Process dialog에서는 현재 실행되고 있는 process의 list를 보여주고 그 중에서 연결할 process를 선택해서 debugger와 연결해 준다. 여기서는 soffice.bin 프로세스를 선택하고 연결을 누른다.

Debug OpenOffice.org #2-2

2) Debugging을 위해서 program의 종류를 선택해야 한다. 여기서는 Common Language Runtime과 Native를 선택하고 확인을 누른다. 연결이 된 이후에는 일반 debugging과 동일하다.

– God Bless..

이 Post와 연관된 Posts:

  1. Build OpenOffice.Org 2.0.2 on Win32 (Part 2)
  2. Build OpenOffice.Org 2.0.2 on Win32 (Part 1)
  3. Borland C++ Builder 6 : Debugging시 Breakpoint가 제대로 인식되지 않을 경우
Tagged with:  

One Response to Debug OpenOffice.org using MS Visual Studio .NET 2003

  1. IAmDba 님의 말:

    Thanks, this is really what I need.

댓글 남기기

당신의 이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다.

*

다음의 HTML 태그와 속성을 사용할 수 있습니다: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>