Intermixing source code with disassembly

Thomas Doerfler Thomas.Doerfler at embedded-brains.de
Tue Apr 8 06:30:10 UTC 2008


Philip,

maybe this is too obvious and you already checked this, but I noticed, 
that all the RTEMS source files are specified with a slash "/" as the 
directory separator:

C:/Msys/1.0/home/PhilipTeng/rtems-4.8/rtems-4.8.0/c/src/lib/libbsp/sparc/shared/bspstart.c:119


  but in your application path, the directories seem to be separated 
with a backslash "\":

c:\msys\1.0\home\PhilipTeng\app/app.c:188

Maybe this confuses objdump?
This string should be the one passed to GCC during compilation. Maybe 
you can modify your makefile to use only forward slashes (or only 
backslashes).

wkr,
Thomas.



Teng Chee Wan Philip schrieb:
> Yes, I did.
> 
> ------------------------------------------------------------------------
> *From:* Joel Sherrill [mailto:joel.sherrill at oarcorp.com]
> *Sent:* Mon 4/7/2008 10:43 PM
> *To:* Teng Chee Wan Philip
> *Cc:* Chris Johns; rtems-users at rtems.com
> *Subject:* Re: Intermixing source code with disassembly
> 
> Teng Chee Wan Philip wrote:
>  > Thanks, Chris.  I tried the following.  The line number gets inserted
>  > (That is a positive step. :) ) but the disassembled code is still not
>  > intermixed with the application source.
>  >
>  > sparc-rtems4.8-objdump -D --line-numbers --source --demangle app.exe
>  >
>  > There is some differences between code disassembled for the RTEMS OS and
>  > the application.  I extracted part of it out for illustration.
>  >  
> Did you compile your application code with the -g option?
> 
>  > Disassembled code intermixed with RTEMS source
>  > =====================================
>  > 0200ddec <bsp_start>:
>  > bsp_start():
>  > C:/Msys/1.0/home/PhilipTeng/rtems-4.8/rtems-4.8.0/c/src/lib/libbsp/sparc
>  > /shared/bspstart.c:119
>  >  *
>  >  *  This routine does the bulk of the system initialization.
>  >  */
>  > void bsp_start( void )
>  > {
>  >  200ddec:       9d e3 bf 98     save  %sp, -104, %sp
>  > C:/Msys/1.0/home/PhilipTeng/rtems-4.8/rtems-4.8.0/c/src/lib/libbsp/sparc
>  > /shared/bspstart.c:137
>  >    *  This should be enough interrupt stack.
>  >    */
>  >
>  >   Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
>  >
>  >   work_space_start =
>  >  200ddf0:       03 00 80 01     sethi  %hi(0x2000400), %g1
>  >  200ddf4:       23 00 8b 41     sethi  %hi(0x22d0400), %l1
>  >  200ddf8:       da 00 63 c0     ld  [ %g1 + 0x3c0 ], %o5
>  >  200ddfc:       82 14 63 dc     or  %l1, 0x3dc, %g1
>  >  200de00:       c8 00 60 04     ld  [ %g1 + 4 ], %g4
>  > C:/Msys/1.0/home/PhilipTeng/rtems-4.8/rtems-4.8.0/c/src/lib/libbsp/sparc
>  > /shared/bspstart.c:128
>  >    * Set up our hooks
>  >    * Make sure libc_init is done before drivers initialized so that
>  >    * they can use atexit()
>  >    */
>  >
>  >   Cpu_table.pretasking_hook = bsp_pretasking_hook;    /* init libc, etc.
>  > */
>  >  200de04:       03 00 80 37     sethi  %hi(0x200dc00), %g1
>  >  200de08:       82 10 62 64     or  %g1, 0x264, %g1     ! 200de64
>  > <bsp_pretasking_hook>
>  >  200de0c:       07 00 8b 41     sethi  %hi(0x22d0400), %g3
>  >
>  > Disassembled code intermixed with line number but not source
>  > ==============================================
>  > c:\msys\1.0\home\PhilipTeng\app/app.c:188
>  >  20013e4:       40 00 1b 78     call  20081c4 <canMastInit>
>  >  20013e8:       90 10 20 04     mov  4, %o0
>  >  20013ec:       80 a2 20 01     cmp  %o0, 1
>  >  20013f0:       22 80 00 8b     be,a   200161c <Init+0x43c>
>  >  20013f4:       11 00 80 8f     sethi  %hi(0x2023c00), %o0
>  > c:\msys\1.0\home\PhilipTeng\app/app.c:194
>  >  20013f8:       11 00 80 8f     sethi  %hi(0x2023c00), %o0
>  >  20013fc:       40 00 6f 15     call  201d050 <puts>
>  >  2001400:       90 12 23 d0     or  %o0, 0x3d0, %o0     ! 2023fd0
>  > <__DTOR_END__+0x300>
>  > c:\msys\1.0\home\PhilipTeng\app/app.c:198
>  >  2001404:       40 00 18 8f     call  2007640
>  > <ccsds_initialisePacketLayer>
>  >  2001408:       90 10 20 01     mov  1, %o0
>  >  200140c:       80 a2 20 01     cmp  %o0, 1
>  >  2001410:       22 80 00 8b     be,a   200163c <Init+0x45c>
>  >  2001414:       11 00 80 8f     sethi  %hi(0x2023c00), %o0
>  >
>  >
>  > -----Original Message-----
>  > From: Chris Johns [mailto:chrisj at rtems.org]
>  > Sent: Sunday, April 06, 2008 6:01 AM
>  > To: Teng Chee Wan Philip
>  > Cc: rtems-users at rtems.com
>  > Subject: Re: Intermixing source code with disassembly
>  >
>  > Teng Chee Wan Philip wrote:
>  >  
>  >> I was trying to disassemble my executable and intermix source code
>  >>    
>  > with
>  >  
>  >> the disassembly, but objdump did not managed to find the source code.
>  >>    
>  >
>  >  
>  >> Does anyone have any suggestions why this could be so?  Are there any
>  >> limitations on objdump or specific way that objdump uses to search for
>  >>    
>  >
>  >  
>  >> the source code?
>  >>
>  >> $ sparc-rtems4.8-objdump -d -S app.exe
>  >>
>  >>    
>  >
>  > You might want to check the Debugging Hints page in the Wiki:
>  >
>  > http://www.rtems.org/wiki/index.php/DebuggingHints#Symbolic_Debug_Inform
>  > ation
>  > http://www.rtems.org/wiki/index.php/DebuggingHints#GDB_Cannot_Find_My_So
>  > urce_Files
>  >
>  > Let us know if this does not help.
>  >
>  > Regards
>  > Chris
>  >
>  > _______________________________________________
>  > rtems-users mailing list
>  > rtems-users at rtems.com
>  > http://rtems.rtems.org/mailman/listinfo/rtems-users
>  >  
> 
> 
> --
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel.sherrill at OARcorp.com        On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>    Support Available             (256) 722-9985
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users


-- 
--------------------------------------------
embedded brains GmbH
Thomas Doerfler           Obere Lagerstr. 30
D-82178 Puchheim          Germany
Tel. : +49-89-18 90 80 79-2
Fax  : +49-89-18 90 80 79-9
email: Thomas.Doerfler at embedded-brains.de
PGP public key available on request

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list