맞춤형 Linux 커널을 사용하여 beaglebone black에 gdb 설치

맞춤형 Linux 커널을 사용하여 beaglebone black에 gdb 설치

저는 beaglebone black용 애플리케이션을 개발 중입니다. arm gcc 컴파일러를 사용하여 크로스 컴파일한 다음 scp명령을 사용하여 컴파일된 바이너리를 beaglebone black으로 포팅하고 보드에서 실행합니다.

애플리케이션은 한동안 완벽하게 실행 중이었는데 나중에 분할 오류가 발생했습니다. 몇 가지 조사를 한 후 디버깅을 사용할 수 있다는 것을 알았지 만 보드에 설치하는 방법이나 호스트 시스템을 사용하여 디버깅하는 다른 방법이 무엇인지 gdb문제에 직면했습니다 .gdbgdbserver

분할 오류를 디버그하도록 도와주세요.

답변1

먼저, cross-gdb가 필요합니다. 이렇게 하려면 gdb 소스 코드를 다운로드하고 압축을 풀고 실행한 ./configure --target=arm-linux-gnueabi다음 평소대로 진행하세요 make; make install. 이제 설치가 완료되었을 것입니다 gdb-linux-gnueabi. 달리다. beaglebone에서 실행합니다 gdbserver 0.0.0.0:1234. cross-gdb를 실행하는 머신에서 target remote 192.168.12.34:1234BBB의 IP 주소로 대체하는 명령을 입력합니다. 이제 평소처럼 gdb 세션을 사용할 수 있습니다.

그러나 몇 가지 주의 사항이 있습니다.

  1. 프로세스를 시작하려고 하지 말고 대신 "continue"(또는 "c") 명령을 사용하십시오.
  2. 디버깅 중인 프로세스를 종료하면 gdbserver종료됩니다. 다른 세션을 실행하려면 다시 시작하면 됩니다. gdb는 중단점 등을 기억합니다. 그러나 target remote명령을 다시 실행 해야 합니다 .
  3. Gdbserver는 디버깅된 프로그램의 이미지를 gdb로 보내지 않습니다. 이를 직접 수행해야 합니다. 개인적으로 가장 쉬운 방법은 NFS를 사용하는 것이라고 생각합니다.

답변2

타겟 비글본 블랙으로부터 다음과 같은 응답을 받았습니다.

Remote debugging from host 192.168.1.1                                          
[getpkt: discarding char '+']                                                   
getpkt ("qSupported:multiprocess+;xmlRegisters=i386;qRelocInsn+");  [sending ac 
[sent ack]                                                                      
putpkt ("$PacketSize=3fff;QPassSignals+;QProgramSignals+;qXfer:libraries-svr4:r]
[received '+' (0x2b)]                                                           
getpkt ("QStartNoAckMode");  [sending ack]                                      
[sent ack]                                                                      
[noack mode enabled]                                                            
putpkt ("$OK#9a"); [noack mode]                                                 
[getpkt: discarding char '+']                                                   
getpkt ("Hgp0.0");  [no ack sent]                                               
putpkt ("$OK#9a"); [noack mode]                                                 
getpkt ("qXfer:features:read:target.xml:0,fff");  [no ack sent]                 
putpkt ("$l<?xml version="1.0"?>                                                
<!-- Copyright (C) 2009-2012 Free Software Foundation, Inc.                     

 *!Copying and distribution of this file, with or without modification,         
 *!are permitted in any medium without royalty provided the copyright           
 *!notice and this notice are preserved.  -->                                   

<!DOCTYPE target SYSTEM "gdb-target.dtd">                                       
<target>                                                                        
  <xi:include href="arm-core.xml"/>                                             
  <xi:include href="arm-vfpv3.xml"/>                                            
  <feature name="org.gnu.gdb.arm.neon"/>                                        
</target>                                                                       
#b0"); [noack mode]                                                             
getpkt ("qXfer:features:read:arm-core.xml:0,fff");  [no ack sent]               
putpkt ("$l<?xml version="1.0"?>                                                
<!-- Copyright (C) 2007-2012 Free Software Foundation, Inc.                     

 *!Copying and distribution of this file, with or without modification,         
 *!are permitted in any medium without royalty provided the copyright           
 *!notice and this notice are preserved.  -->                                   

<!DOCTYPE feature SYSTEM "gdb-target.dtd">                                      
<feature name="org.gnu.gdb.arm.core">                                           
  <reg name="r0" bitsize="32" type="uint32"/>                                   
  <reg name="r1" bitsize="32" type="uint32"/>                                   
  <reg name="r2" bitsize="32" type="uint32"/>                                   
  <reg name="r3" bitsize="32" type="uint32"/>                                   
  <reg name="r4" bitsize="32" type="uint32"/>                                   
  <reg name="r5" bitsize="32" type="uint32"/>                                   
  <reg name="r6" bitsize="32" type="uint32"/>                                   
  <reg name="r7" bitsize="32" type="uint32"/>                                   
  <reg name="r8" bitsize="32" type="uint32"/>                                   
  <reg name="r9" bitsize="32" type="uint32"/>                                   
  <reg name="r10" bitsize="32" type="uint32"/>                                  
  <reg name="r11" bitsize="32" type="uint32"/>                                  
  <reg name="r12" bitsize="32" type="uint32"/>                                  
  <reg name="sp" bitsize="32" type="data_ptr"/>                                 
  <reg name="lr" bitsize="32"/>                                                 
  <reg name="pc" bitsize="32" type="code_ptr"/>                                 

  <!-- The CPSR is register 25, rather than register 16, because                
 *" the FPA registers historically were placed between the PC                   
 *" and the CPSR in the "g" packet.  -->                                        
  <reg name="cpsr" bitsize="32" regnum="25"/>                                   
</feature>                                                                      
#13"); [noack mode]                                                             
getpkt ("qXfer:features:read:arm-vfpv3.xml:0,fff");  [no ack sent]              
putpkt ("$l<?xml version="1.0"?>                                                
<!-- Copyright (C) 2009-2012 Free Software Foundation, Inc.                     

 *!Copying and distribution of this file, with or without modification,         
 *!are permitted in any medium without royalty provided the copyright           
 *!notice and this notice are preserved.  -->                                   

<!DOCTYPE feature SYSTEM "gdb-target.dtd">                                      
<feature name="org.gnu.gdb.arm.vfp">                                            
  <reg name="d0" bitsize="64" type="ieee_double"/>                              
  <reg name="d1" bitsize="64" type="ieee_double"/>                              
  <reg name="d2" bitsize="64" type="ieee_double"/>                              
  <reg name="d3" bitsize="64" type="ieee_double"/>                              
  <reg name="d4" bitsize="64" type="ieee_double"/>                              
  <reg name="d5" bitsize="64" type="ieee_double"/>                              
  <reg name="d6" bitsize="64" type="ieee_double"/>                              
  <reg name="d7" bitsize="64" type="ieee_double"/>                              
  <reg name="d8" bitsize="64" type="ieee_double"/>                              
  <reg name="d9" bitsize="64" type="ieee_double"/>                              
  <reg name="d10" bitsize="64" type="ieee_double"/>                             
  <reg name="d11" bitsize="64" type="ieee_double"/>                             
  <reg name="d12" bitsize="64" type="ieee_double"/>                             
  <reg name="d13" bitsize="64" type="ieee_double"/>                             
  <reg name="d14" bitsize="64" type="ieee_double"/>                             
  <reg name="d15" bitsize="64" type="ieee_double"/>                             
  <reg name="d16" bitsize="64" type="ieee_double"/>                             
  <reg name="d17" bitsize="64" type="ieee_double"/>                             
  <reg name="d18" bitsize="64" type="ieee_double"/>                             
  <reg name="d19" bitsize="64" type="ieee_double"/>                             
  <reg name="d20" bitsize="64" type="ieee_double"/>                             
  <reg name="d21" bitsize="64" type="ieee_double"/>                             
  <reg name="d22" bitsize="64" type="ieee_double"/>                             
  <reg name="d23" bitsize="64" type="ieee_double"/>                             
  <reg name="d24" bitsize="64" type="ieee_double"/>                             
  <reg name="d25" bitsize="64" type="ieee_double"/>                             
  <reg name="d26" bitsize="64" type="ieee_double"/>                             
  <reg name="d27" bitsize="64" type="ieee_double"/>                             
  <reg name="d28" bitsize="64" type="ieee_double"/>                             
  <reg name="d29" bitsize="64" type="ieee_double"/>                             
  <reg name="d30" bitsize="64" type="ieee_double"/>                             
  <reg name="d31" bitsize="64" type="ieee_double"/>                             

  <reg name="fpscr" bitsize="32" type="int" group="float"/>                     
</feature>                                                                      
#cf"); [noack mode]                                                             
getpkt ("QNonStop:0");  [no ack sent]                                           
[all-stop mode enabled]                                                         
putpkt ("$OK#9a"); [noack mode]                                                 
getpkt ("?");  [no ack sent]                                                    
putpkt ("$T050b:0*"00;0d:10feffbe;0f:800c4648;thread:p533.533;core:0;#4f"); [no]
getpkt ("Hc-1");  [no ack sent]                                                 
putpkt ("$E01#a6"); [noack mode]                                                
getpkt ("qC");  [no ack sent]                                                   
putpkt ("$QCp533.533#68"); [noack mode]                                         
getpkt ("qAttached:533");  [no ack sent]                                        
putpkt ("$0#30"); [noack mode]                                                  
getpkt ("g");  [no ack sent]                                                    
putpkt ("$0*}0*"010feffbe0*"00800c464830*}0*}0*}0*}0*}0*F#f5"); [noack mode]    
readchar: Got EOF                                                               
[getpkt: discarding char '�']                                                   
Remote side has terminated connection.  GDBserver will reopen the connection.   
Listening on port 1234                                                          

이것은 내가 사용하고 있는 우분투 시스템의 응답입니다.

(gdb) target remote 192.168.1.2:1234
Remote debugging using 192.168.1.2:1234
warning: Architecture rejected target-supplied description
Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010feffbe00000000800c4648300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
(gdb) 

관련 정보