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