Find the answer to your Linux question:
Results 1 to 3 of 3
Hi All, I'm trying to debug a program that I crosscompiled on a arm9. The crosscompiler uses . spec files to create RPM packages for the target system. The program ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    2

    Strange debug problem

    Hi All,
    I'm trying to debug a program that I crosscompiled on a arm9.
    The crosscompiler uses . spec files to create RPM packages for the target system.
    The program compiles and runs correctly except when i run the program with gdb and then type list I get this message:
    Code:
    1       main.c: No such file or directory.
            in main.c
    I made sure I compiled the program with CFLAGS=-g by putting this in the .spec file.
    when the application crosscompiles (I believe) it shows it compiled succesfully with the -g flags:
    Code:
     checking whether gcc accepts -g... (cached) yes 
    ...
    ...
    + make CFLAGS=-g
    make  all-recursive
    make[1]: Entering directory `/home/notroot/ltib/rpm/BUILD/rtsp_imp-0.1'
    Making all in src
    make[2]: Entering directory `/home/notroot/ltib/rpm/BUILD/rtsp_imp-0.1/src'
      CC     main.o
      CCLD   rtsp_imp
    make[2]: Leaving directory `/home/notroot/ltib/rpm/BUILD/rtsp_imp-0.1/src'
    Making all in po
    make[2]: Entering directory `/home/notroot/ltib/rpm/BUILD/rtsp_imp-0.1/po'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/notroot/ltib/rpm/BUILD/rtsp_imp-0.1/po'
    make[2]: Entering directory `/home/notroot/ltib/rpm/BUILD/rtsp_imp-0.1'
    make[2]: Leaving directory `/home/notroot/ltib/rpm/BUILD/rtsp_imp-0.1'
    make[1]: Leaving directory `/home/notroot/ltib/rpm/BUILD/rtsp_imp-0.1'
    However when i run the program with gdb, i can't debug because there is no source code available..
    I am really wondering if I am doing something basic wrong?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Are you using the arm-compatible gdb, or are you trying to use your host debugger?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    2
    I am using ARM-compatible gdb, and LTIB (linux target image builder) as my cross compiler/toolchain.
    I researched a little bit about debugging and then looked over the stackinformation again. It seems that the code is being optimized, so I must have some wrong information in my .spec file I guess

    Code:
     #1  0x403bc124 in _g_gnulib_vasnprintf (resultbuf=0x0, lengthp=0xbe9c75cc, 
        format=<value optimized out>, args=<value optimized out>)
    .spec file:
    Code:
    %define pfx /opt/freescale/rootfs/%{_target_cpu}
    
    Name           : rtsp_imp
    Version         : 0.1
    Release        : 1
    Summary      : RTSP Server Implementatie
    License         : LGPL
    Vendor          : Dealogic
    Packager      : Ferdinand Jacobs
    Group           : Applications/System
    Source          : %{name}-%{version}.tar.gz
    BuildRoot       : %{_tmppath}/%{name}
    Prefix          : %{pfx}
    
    %Description
    %{summary}
    
    %Prep
    %setup -n rtsp_imp-%{version}
    
    %Build
    ./configure --prefix=%{_prefix} --build=%{_build} --host=arm-none-linux-gnueabi \
                --disable-valgrind --without-check  --enable-maintainer-mode 
    	   
    make 'CFLAGS=-g' 'CXXFLAGS=-g' 'JFLAGS=-g' 'FFLAGS=-g'
    
    %Install
    rm -rf $RPM_BUILD_ROOT
    make install DESTDIR=$RPM_BUILD_ROOT/%{pfx}
    find $RPM_BUILD_ROOT/%{pfx}/%{_prefix}/lib/ -name "*.la" | xargs rm -f
    rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
    rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
    
    %Clean
    rm -rf $RPM_BUILD_ROOT
    
    %Files
    %defattr(-,root,root)
    %{pfx}/*

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...