Sunday, September 5, 2010

Debugging with gdb

Hi all,
i need to setup a remote debug session of a QT application.
Since i have some problems i started with a local debugging using gdb ./app + run. This was ok.
Then i used two shells in which i launched gdbserver in the first one and gdb in the second one.

gdbserver:

Qt Code:
Switch view 1.[root@centos-sd seashell]# gdbserver :2345 ./seadragonshellapp2.Process ./seadragonshellapp created; pid = 70633.Listening on port 23454.Remote debugging from host 127.0.0.1[root@centos-sd seashell]# gdbserver :2345 ./seadragonshellapp
Process ./seadragonshellapp created; pid = 7063
Listening on port 2345
Remote debugging from host 127.0.0.1To copy to clipboard, switch view to plain text mode

gdb:

Qt Code:
Switch view 1.(gdb) target remote :23452.Remote debugging using :23453.0x0097f7c0 in ?? ()4.(gdb) list5.No symbol table is loaded. Use the "file" command.6.(gdb) run7.The program being debugged has been started already.8.Start it from the beginning? (y or n) n9.Program not restarted.10.(gdb) start11.No symbol table loaded. Use the "file" command.12.(gdb)(gdb) target remote :2345
Remote debugging using :2345
0x0097f7c0 in ?? ()
(gdb) list
No symbol table is loaded. Use the "file" command.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) start
No symbol table loaded. Use the "file" command.
(gdb)To copy to clipboard, switch view to plain text mode

I don't understand why since the project is the same
Any known problem on gdbserver?

Thanks


...................................................................
Try:
gdb ./seadragonshellapp
(gdb) target remote :2345
(gdb) cont

GDB를 이용한 디버깅 설명 사이트 주소

http://korea.gnu.org/manual/release/gdb/gdb.html

How to use gdb server

디버깅 방식은 원격 디버깅방법을 사용할려고 합니다.

그래서 관련 자료를 찾아보니 다음과 같이 하더군요

호스트 PC <-----------------------> 타겟보드
gdb <-----------------------> gdbserver

GDB-5.3을 사용했습니다.

먼저 호스트PC에는 다음과 같이 설정 및 컴파일 했습니다.

./configure --host=i686-pc-linux-gnu --prefix=/usr/local/gdb-5.3-x86 --norecursion

이렇게 하니 호스트PC의 /usr/local/gdb-5.3-x86 디렉토리에 설치가 되더군요..

그래서 테스트삼아 hello 프로그램을 작성하여 gdb 를 실행하니 잘 됩니다.


이제는 타겟보드에 사용될 GDB는 다음과 같이 설정 및 컴파일했습니다.

./configure --target=arm-linux --host=arm-linux --build=i686-pc-linux-gnu --prefix=/usr/local/gdb-5.3-x86 --norecursion

호스트PC의 /usr/local/gdb-5.3-arm 디렉토리에 설치되더군요...

file 명령어를 사용하여 /usr/local/gdb-5.3-arm/bin 디렉토리에 있는 실행파일들을 살펴보니 ARM 버전으로 잘 나왔습니다.

그래서 타겟보드상의 /usr/local 디렉토리에 nfs 를 이용하여 복사를 했습니다.

즉 호스트 PC의 ARM용 GDB를 타겟보드에 탑재하였습니다.

타겟보드의 /usr/local/gdb-5.3-arm/bin 디렉토리에는 gdb, gdbserver 실행파일이 있습니다.

그래서 먼저 타겟보드에서 다음과 같이 실행했습니다.

(1) # gdbserver 203.253.176.177:8080 hello

Process hello created; pid = 73

그리고 호스트PC에서 다음과 같이 실행했습니다.

(2) # gdb
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".

(3) (gdb) target remote 203.253.176.177:8080 hello
Remote debugging using 203.253.176.177 hello
0x00000000 in ?? ()

출력이 어째 좀 이상합니다. (3)을 호스트PC에서 실행시켰을때 타겟보드에서는 다음과 같이 출력됩니다.

(4) Remote debugging from host 203.253.176.177


그래서 호스트PC에서 gdb의 명령어를 실행하면 다음과 같이 출력됩니다.

(gdb) b hello.c:7
No symbol table is loaded. Use the "file" command.
(gdb) n
Cannot find bounds of current function
(gdb) list
No symbol table is loaded. Use the "file" command.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program:
No executable file specified.
Use the "file" or "exec-file" command.


그리고 타겟보드에서는 다음과 같이 출력되고 끝나버립니다.

Killing inferior

뭐가 잘못된 건지요...

제가 잘못 설정하고 컴파일했나요?

도움부탁드립니다.

How to Qt Embeded debugging?

1. qt 에서 디버깅 해보려면 qDebug 나 printf문으로
중간 중간 심어 놓고 재대로 값이 나오나 확인해보면서 작업하는데요..

2. 그리고 Makefile 보니까 플래그 중에 -DQT_NO_DEBUG 로 설정 돼있는데..

디버깅 정보를 빼는 옵션 같은데요 이걸 -DQT_DEBUG로 고쳐서 컴파일하면..
디버깅 정보가 생길텐데.. 그럼 뭘로 디버깅 추적이 가능한지요?

//////////////////////////////////////////////////////////////////
타켓으로 내리면
gdbserver이나,( 가능 사용해봤습니다.)
gdb에서 remote 검색해보니까( 시리얼통신으로
gdb에서도 가능한거 같네요.. 타켓으로 내리면

Wednesday, August 11, 2010

폰트 작은거 나의 성공사례

./launcher -qws -display :LinuxFb:/dev/fb2:mmWidth106:mmHeight62:0 &

Qt : 타겟에서 실행시 이미지와 폰트가 작게 나올경우

[QT/Embedded] QT4.4.3 을 보드에 포팅하였는데 기본폰트 크기가 너무 작습니다

답변이 없어서 자답을 하게 되네요...
후에 이와 관련된 문제가 있을시에 도움을 주고자 자답을 합니다.

QT4로 오면서 QWS_DISPLAY를 자신의 하드웨어와 매칭시켜주어야 하는것 같더군요.

그래서 저는 embedded설정하는 곳에서
export QWS_DISPLAY="LinuxFb:mmWidth=400:mmHeight=240"
으로 설정하였습니다.

제 보드의 화면 크기는 800*480인데 이를 반으로 줄여주었습니다.

이렇게 하여 화면에 디스플레이하는것을 조정하였습니다.

다음분들도 이런방법으로 해결하시길 빕니다. 답변이 없어서 자답을 하게 되네요...
후에 이와 관련된 문제가 있을시에 도움을 주고자 자답을 합니다.

QT4로 오면서 QWS_DISPLAY를 자신의 하드웨어와 매칭시켜주어야 하는것 같더군요.

그래서 저는 embedded설정하는 곳에서
export QWS_DISPLAY="LinuxFb:mmWidth=400:mmHeight=240"
으로 설정하였습니다.

제 보드의 화면 크기는 800*480인데 이를 반으로 줄여주었습니다.

이렇게 하여 화면에 디스플레이하는것을 조정하였습니다.

다음분들도 이런방법으로 해결하시길 빕니다.