Intermixing source code with disassembly

Teng Chee Wan Philip tcheewan at ntu.edu.sg
Tue Apr 8 10:11:27 UTC 2008


Hi,

I attached the makefile for reference.  How do I modify the makefile for
forward or backward slashes?

Initially, I thought that will be a problem.  But when I tried with the
ticker application, the slash remains mixed but the source was
intermixed....Unless size of the application is an issue.

Part of the disassembled file from ticker
=============================

02001498 <Test_task>:
Test_task():
c:\msys\1.0\home\PhilipTeng\ticker4/tasks.c:25
#include "system.h"

rtems_task Test_task(
  rtems_task_argument unused
)
{
 2001498:	9d e3 bf 60 	save  %sp, -160, %sp
c:\msys\1.0\home\PhilipTeng\ticker4/tasks.c:31
  rtems_id          tid;
  rtems_time_of_day time;
  uint32_t    task_index;
  rtems_status_code status;

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
 200149c:	90 10 20 00 	clr  %o0
 20014a0:	92 10 20 00 	clr  %o1
 20014a4:	40 00 2e 41 	call  200cda8 <rtems_task_ident>
 20014a8:	94 07 bf f4 	add  %fp, -12, %o2
c:\msys\1.0\home\PhilipTeng\ticker4/tasks.c:32
  task_index = task_number( tid );
 20014ac:	03 00 80 ac 	sethi  %hi(0x202b000), %g1
 20014b0:	c4 00 62 74 	ld  [ %g1 + 0x274 ], %g2	!
202b274 <_Configuration_Table>
 20014b4:	03 00 00 3f 	sethi  %hi(0xfc00), %g1
 20014b8:	c6 00 a0 2c 	ld  [ %g2 + 0x2c ], %g3
 20014bc:	c4 07 bf f4 	ld  [ %fp + -12 ], %g2
 20014c0:	82 10 63 ff 	or  %g1, 0x3ff, %g1
 20014c4:	c8 00 e0 24 	ld  [ %g3 + 0x24 ], %g4
 20014c8:	84 08 80 01 	and  %g2, %g1, %g2
c:\msys\1.0\home\PhilipTeng\ticker4/tasks.c:39
    status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
    if ( time.second >= 35 ) {
      puts( "*** END OF CLOCK TICK TEST ***" );
      rtems_test_exit( 0 );
    }
    put_name( Task_name[ task_index ], FALSE );
 20014cc:	03 00 80 ab 	sethi  %hi(0x202ac00), %g1
c:\msys\1.0\home\PhilipTeng\ticker4/tasks.c:32
  rtems_time_of_day time;
  uint32_t    task_index;
  rtems_status_code status;

  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
  task_index = task_number( tid );
 20014d0:	ae 20 80 04 	sub  %g2, %g4, %l7
c:\msys\1.0\home\PhilipTeng\ticker4/tasks.c:39

-----Original Message-----
From: Chris Johns [mailto:chris at contemporary.net.au] 
Sent: Tuesday, April 08, 2008 3:47 PM
To: Thomas Doerfler
Cc: Teng Chee Wan Philip; rtems-users at rtems.com
Subject: Re: Intermixing source code with disassembly

Hi Thomas,

I noticed this and I was trying to figure out if this is a problem. I
have not 
been able to get a test case with the mixed paths.

Philip, how do you build the application ?

Regards
Chris

Thomas Doerfler wrote:
> 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
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Copy of Makefile
Type: application/octet-stream
Size: 2604 bytes
Desc: Copy of Makefile
URL: <http://lists.rtems.org/pipermail/users/attachments/20080408/efdb31ce/attachment.obj>


More information about the users mailing list