성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] 아쉽게도, 커뮤니티는 아니고 개인 블로그입니다. ^^
[정성태] 질문이 잘 이해가 안 됩니다. 우선, 해당 소스코드에서 ILis...
[양승조
] var대신 dinamic으로 선언해서 해결은 했습니다. 맞는 해...
[양승조
] 또 막혔습니다. ㅠㅠ var list = props[i].Ge...
[양승조
] 아. 감사합니다. 어제는 안됐던것 같은데....정신을 차려야겠네...
[정성태] "props[i].GetValue(props[i])" 코드에서 ...
[정성태] 저렇게 조각 코드 말고, 실제로 재현이 되는 예제 프로젝트를 압...
[정성태] Modules 창(Ctrl+Shift+U)을 띄워서, 해당 Op...
[정성태] 만드실 수 있습니다. 단지, Unity 엔진 내의 스크립트와 W...
[공진영] 안녕하세요 좋은글 감사합니다. 현재 제가 wpf로 관제 모...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <h1 style='font-family: Malgun Gothic, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>Eclipse 원격 디버깅 - Cannot run program "gdb": Launching failed</h1> <p> 지난 글에 따라 원격 디버깅을 선택했을 때,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > 라즈베리 파이 제로 용 프로그램 개발을 위한 Eclipse C/C++ 윈도우 환경 설정 ; <a target='tab' href='https://www.sysnet.pe.kr/2/0/12627'>https://www.sysnet.pe.kr/2/0/12627</a> </pre> <br /> 대부분의 사용자가 다음과 같은 오류가 발생할 것입니다.<br /> <br /> <img alt='eclipse_remote_debug_gdb_error_1.png' src='/SysWebRes/bbs/eclipse_remote_debug_gdb_error_1.png' /><br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Last login: Tue May 4 23:23:09 2021 from 172.30.1.26 chmod 755 /home/pi/sample/blink;gdbserver :2345 /home/pi/sample/blink;exit pi@raspberrypi:~$ chmod 755 /home/pi/sample/blink;gdbserver :2345 /home/pi/sample/blink;exit Process /home/pi/sample/blink created; pid = 18911 Listening on port 2345 </pre> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > 'Launching ...' has encountered a problem. Error with command: gdb --version Cannot run program "gdb": Launching failed </pre> <br /> 원인은, 원격 gdbserver에 연결해야 할 로컬 gdb.exe의 위치를 찾을 수 없어 발생하는 것입니다. 따라서, 다음의 경로에서 gdb를 다운로드해 사용하거나,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > GDB: The GNU Project Debugger ; <a target='tab' href='https://www.gnu.org/software/gdb/download/'>https://www.gnu.org/software/gdb/download/</a> </pre> <br /> 아마도 대부분의 개발자 PC라면 C 드라이브에 gdb.exe 하나쯤은 있을 것이므로 그걸 재사용해도 됩니다. 어쨌든, 해당 gdb.exe의 경로를 "Run" / "Run Configurations..."의 "C/C++ Remote Application" 설정으로 들어가 설정해 주시면 됩니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > GDB debugger: C:\Octave\Octave-4.4.0\bin\<span style='color: blue; font-weight: bold'>gdb.exe</span> </pre> <br /> <hr style='width: 50%' /><br /> <br /> 그런데, 일반적인 원격 디버깅이라면 저 단계에서 통과를 했겠지만 원격지 컴퓨터가 "라즈베리 파이"라면 문제가 좀 달라집니다. 실제로 gdb.exe의 경로를 지정한 후에도 다음과 같은 식의 오류가 발생할 수 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > 'Launching ...' has encountered a problem. Error in final launch sequence: Failed to execute MI command: -target-select remote raspberrypi.local:2345 Error message from debugger back end: Truncated register 33 in remote 'g' packet </pre> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Error in final launch sequence: Failed to execute MI command: -target-select remote raspberrypi.local:2345 Error message from debugger back end: Truncated register 33 in remote 'g' packet Failed to execute MI command: -target-select remote raspberrypi.local:2345 Error message from debugger back end: Truncated register 33 in remote 'g' packet Truncated register 33 in remote 'g' packet </pre> <br /> 이것은 수작업으로도 재현할 수 있는데요, 이를 위해 원격지 컴퓨터의 gdbserver를 다음과 같이 구동해 두고,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > $ <span style='color: blue; font-weight: bold'>gdbserver :2345 /home/pi/sample/blink</span> Process /home/pi/sample/blink created; pid = 22621 Listening on port 2345 Remote debugging from host 172.30.1.26 Remote side has terminated connection. GDBserver will reopen the connection. Listening on port 2345 </pre> <br /> 로컬 PC의 gdb.exe를 수행해 서버로 연결하면, 그와 동시에 서버는 연결을 reset 한다는 메시지를 남기고,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > Remote debugging from host 172.30.1.26 Remote side has terminated connection. GDBserver will reopen the connection. Listening on port 2345 </pre> <br /> 클라이언트 측에서는 Eclipse의 디버그 화면에서 봤던 그 오류가 나옵니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > C:\temp> <span style='color: blue; font-weight: bold'>C:\Octave\Octave-4.4.0\bin\gdb.exe -q</span> (gdb) <span style='color: blue; font-weight: bold'>target remote raspberrypi.local:2345 /home/pi/sample/blink</span> Remote debugging using raspberrypi.local:2345 /home/pi/sample/blink warning: while parsing target description (at line 10): Target description specified unknown architecture "arm" warning: Could not load XML target description; ignoring Reading /home/pi/sample/blink from remote target... warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration of GDB. Attempting to continue with the default i386 settings. Reading /home/pi/sample/blink from remote target... Reading symbols from target:/home/pi/sample/blink...done. <span style='color: blue; font-weight: bold'>Truncated register 33 in remote 'g' packet</span> (gdb) </pre> <br /> 왜냐하면, 서버와 클라이언트의 architecture 환경이 다르다는 것이 그 이유이며 이것 역시 "GNU toolchain for raspberry"에 포함된 버전의 gdb.exe를 사용해야 합니다. 실제로 위의 gdbserver 실행 상태에서 arm-linux-gnueabihf-gdb.exe로 접속하면 잘 동작하는 것을 확인할 수 있습니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > C:\temp> <span style='color: blue; font-weight: bold'>C:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gdb.exe</span> GNU gdb (Raspbian 8.2.1-2) 8.2.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i686-w64-mingw32 --target=arm-linux-gnueabihf". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word". (gdb) <span style='color: blue; font-weight: bold'>target remote raspberrypi.local:2345 /home/pi/sample/blink</span> Remote debugging using raspberrypi.local:2345 /home/pi/sample/blink No executable file now. 0xb6fcea30 in ?? () // 이후 접속 종료는 이렇게! (gdb) monitor exit (gdb) quit </pre> <br /> 결국, Eclipse의 프로젝트 설정에 다음과 같이 반영해야 하는 것입니다.<br /> <br /> <img onclick='toggle_img(this)' class='imgView' alt='eclipse_remote_debug_gdb_error_2.png' src='/SysWebRes/bbs/eclipse_remote_debug_gdb_error_2.png' /><br /> </p><br /> <br /><hr /><span style='color: Maroon'>[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
1196
(왼쪽의 숫자를 입력해야 합니다.)