gdb 서버 질문입니다.

lovejin0309의 이미지

arm 에서 어플을 개발하고 있습니다.

디버깅을 하기 위해 gdb server를 arm용으로 컴파일하고 타겟 보드에 올린후 다음과 같이 실행시켰습니다.


./gdbserver 192.168.1.150:9012 debug
Process ./debug created; pid = 94

호스트에서 다음과 같이 접속했습니다.

lovejin:~# gdb
GNU gdb 6.1-debian
Copyright 2004 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 "i386-linux".
(gdb) target remote 192.168.1.150:9012
Remote debugging using 192.168.1.150:9012
0x00000000 in ?? ()

이렇게 하면 타켓쪽에서는 다음과 같은 메세지가 뜹니다.


Remote debugging from host 192.168.1.19
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) list
No symbol table is loaded.  Use the "file" command.
(gdb) file
A program is being debugged already.  Kill it? (y or n) y
No executable file now.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
No symbol file now.

해결 방안이 무엇일까요?

crimsoncream의 이미지

gdbserver를 실행시킬때 실행파일을 명시하거나 프로세스에 attach해야 하지 않나요?

그리고 host쪽에서 symbol을 읽어들이는건 target 하기 전에 하셔야 할 것 같고요.

즉 hello를 디버그 하실 생각이시면

gdbserver x.x.x.x.:nnnn hello
하시고

gdb
file hello
target remote ~~
run

오늘 우리는 동지를 땅에 묻었습니다. 그러나 땅은 이제 우리들의 것입니다.
아직도 우리의 적은 강합니다. 그러나 우리는 그들보다 많습니다.
항상 많을 것입니다.

lovejin0309의 이미지

gdb
file debug
target remote ....
run

을 하면,

cannot execute binary file이라고 나오는 군요.

debug란 파일을
arm-linux-gcc로 컴파일 했고, 타겟보드로 복사했습니다.

file debug라고 하면, 현재 호스트에 있는 파일이 로드 되는게 아닌가요? (어차피 그 파일도 arm용입니다.)

arm용 파일이 로드 된 상태에서 run을 하기 때문에 실행이 안되는 것인가 하는 의문이 듭니다.

익명 사용자의 이미지

lovejin0309 wrote:
gdb
file debug
target remote ....
run

을 하면,

cannot execute binary file이라고 나오는 군요.

debug란 파일을
arm-linux-gcc로 컴파일 했고, 타겟보드로 복사했습니다.

file debug라고 하면, 현재 호스트에 있는 파일이 로드 되는게 아닌가요? (어차피 그 파일도 arm용입니다.)

arm용 파일이 로드 된 상태에서 run을 하기 때문에 실행이 안되는 것인가 하는 의문이 듭니다.

host에 있는 gdb의 target이 i386이 아닌가 싶은데요.
확인하는 방법이 잘 기억나지 않는군요. gdb -v 였나?
gdbserver하고 같이 배포된 host i386의 gdb가 있는지 확인해 보십시요.

제 경우에는 거의 제가 빌드를 해서 썼습니다. configure에 target option만 주면 큰 어려움 없이 빌드가 되는 경우가 대부분이므로 이렇게 하시는게 차라리 속 편하실 겁니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.