gdb instalação em beaglebone black com kernel Linux customizado

0

Estou desenvolvendo uma aplicação para o beaglebone black que eu compilei cruzando usando o compilador arm gcc e depois portando o arquivo binário compilado para o beaglebone preto usando o comando scp e rodando lá na placa.

Esta aplicação funciona perfeitamente por algum período de tempo e depois resulta em falha de segmentação. Depois de fazer uma pesquisa, descobri que usando gdb podemos depurá-lo, mas estou enfrentando problema de como instalar o gdb no painel ou quais são as outras maneiras de depurá-lo usando gdbserver da máquina host.

Por favor, ajude-me a depurar a falha de segmentação

    
por Gangadhar 29.09.2015 / 12:25

2 respostas

1

Primeiro, você precisa de um gdb cruzado. Para fazer isso, faça o download da fonte gdb, descompacte-a, execute ./configure --target=arm-linux-gnueabi e, em seguida, a usual make; make install dance. Agora você deve ter um gdb-linux-gnueabi instalado. Executá-lo. No seu beagle, execute gdbserver 0.0.0.0:1234 . Na máquina em que você executa o cross-gdb, forneça o comando target remote 192.168.12.34:1234 , substituindo o endereço IP do seu BBB. Agora você pode usar a sessão do gdb como de costume.

Algumas notas, no entanto:

  1. Você não deve tentar iniciar o processo, você deve usar o comando 'continue' (ou 'c').
  2. Se você eliminar o processo depurado, gdbserver será encerrado. Se você quiser executar outra sessão, apenas reinicie-a; O gdb vai lembrar os pontos de interrupção, etc. Você precisa emitir o comando target remote novamente, no entanto.
  3. O Gdbserver não envia uma imagem do programa depurado para o gdb; você tem que fazer isso sozinho. Pessoalmente, acho que a maneira mais fácil de fazer isso é usar o NFS.
por 29.09.2015 / 12:58
0

Tenho a resposta abaixo do alvo beaglebone black

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                                                          

Esta é a resposta do sistema Ubuntu que estou usando

(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) 
    
por 01.10.2015 / 15:07

Tags