Re: Creating Assembly Code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 23, 2001 at 08:12:06AM +0200, Tinga Shilo wrote:
> I have an oops output that I'd like to understand.
> The oops output shows something like MyFunc+34/78
> The ksymoops man page explains the "34" and "78" properly.
> 
> How can I see exactly where in my code this is ?
> I want to see my source code along with the assembler code
> 
> After some digging, I added in my Makefile the following lines
>     %.s: %.c
>      $(CC) $(CPPFLAGS) $(CFLAGS) -g -S $^
> 
>     %.x: %.s
>      as -a $^ > $@
> 
> That almost does it, but not quite.
> What am I missing ?

- Compile the source file with all normal options and add the "-g"
  flag for debug information
- Run the resulting object file through objdump:
  objdump -D -S foo.o > foo.x
- Lookup MyFunc, go to offset 34 and there is the assembly code
  together with the source

This trick works for all platforms linux runs on (I use it quite often
on arm-linux), it is not limited to the ix86 only.

> Is there a better way to produce this output ?
> BTW: Which line in the source code should be considered as the base for
> "+34" ?

The +34 is the offset from the symbol in the output (i.e.: object)
file, it has nothing to do with the input (i.e.: source) file.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2783635  Fax: +31-15-2781843  Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux