gdbserver 로 원격 디버깅할 때..

air21c의 이미지

안녕하세요.

리눅스 유저인데요.

고급 사양인 서버 A 에서 "a" 라는 프로그램을 저장해놓고,

$ gdbserver 주소:포트 a

라고 하니

"쓰레드 생성되었습니다. 대기중입니다" 라는 의미의 메세지가 나오고..

저 사양의 클라이언트 B ( A 와 B 모두 동일 아키텍쳐 입니다.) 에서

$ gdb a
블라블라 메세지 생략
> remote A주소:포트
하고 엔터를 치니

Remote debugging using 주소:포트
[New Thread 1888]
warning: Could not load vsyscall page because no executable was specified
try using the "file" command first.
0xb8015810 in ?? ()

이라고 나오고 결국 디버깅이 안되네요.

무엇을 잘못한 것인지

답변좀 부탁드릴게요 :)

감사합니다.

엠브리오의 이미지

거꾸로 된것 같은데요.

저사양의 컴퓨터에서 gdbserver를 돌리고 고사양의 컴퓨터에서
gdb를 돌리는게 맞을듯..

어쨌든 gdb쪽에서는 다음과 같이 써줍니다.

(gdb) target remote IP주소:포트
(gdb) break main
(gdb) continue

키포인트는 맨마지막줄의 continue 입니다.

gdbserver를 이용할때는 gdb 쪽에서 run을 하면 안됩니다.
gdbserver를 실행한것 자체가 run 한것으로 간주되므로
continue 라고 써줘야 디버깅이 시작됩니다.

노파심에서 몇자 더 적어보자면, 서로 CPU가 다른 경우엔 크로스 컴파일된
gdb가 필요합니다. 타겟보드가 arm칩이라면 arm-linux-gdb 가 되겠지요.

가끔씩 i386용 gdb를 실행해 놓고 왜 arm용 타겟보드가 디버깅이 안되느냐고
하시는 분들이 있어서 ^^;

air21c의 이미지

답변감사드립니다.

먼저 실제 바이너리가 실행되는 것은 빠른 데서 하고,
저는 저사양의 제 PC 에서 ddd 나 insight 같은 GUI 기반의 gdb 를 활용하고자 하는 것이 목적입니다.
그래서 빠른 PC 에서 gdbserver 로 실행돌리면서
command 만 날리고 싶은 것인데, 제가 잘못된 설정을 한것인지 모르겠습니다.

그리고 gdb 에서
" (gdb) target remote IP주소:포트
(gdb) break main
(gdb) continue
"

여기서 첫 번째 실행하자 마자, No symbol table is loaded. Use the "file" command.
라고 뜨는데, 어떻게 해야 하는 건지 몰라서요.
물론 서로 같은 archi 입니다. :)

감사합니다

jinseo1224의 이미지

저도 원격 디버깅관련 글을 찾다가 방문해서 원격에 대해서는 정확히 모르지만..

No symbol table is loaded 심볼테이블이 없다는 에러는

컴파일할때 -g 옵션을 주지 않아서 디버깅용 심볼테이블이 생성되지 않아서 인듯 합니다.

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.