0

I'm trying to diagnose why a seemingly small C function I wrote has produced a large .text section. I have used arm-elf-size and arm-elf-objdump to isolate the object file and function, but I have only been able to get these tools to produce assembly code, which I don't have the time to reverse engineer.

I tried using gcc switches "-g" which is supposed to be compatible with arm-elf-objdump -g, but it keeps producing the error "No debugging information found," which I've googled around for a bit with no clear cut answer (though other people had an identical problem).

Is there any other means of producing mixed C/assembly files so I can isolate the trouble spot in the function? Thanks!

jerp
  • 257
  • 5
  • 15
  • It's "objdump -S". The rest is in objdump man/info pages. – oakad Nov 25 '13 at 03:26
  • I did try "objdump -S", and all it did was list all of the C code at the top and all of the assembly code at the bottom. I'd like for it to be intertwined so I can isolate specific lines of C code as expanding too large. The man pages did not any any additional information on making it intertwined. – jerp Nov 25 '13 at 13:33
  • That's because you've got optimization enabled. Try to compile your program with -O0.. – oakad Nov 26 '13 at 02:40
  • don't quite understand. what do you mean by surprising about a large .text section while have no time to reverse engineer? i think reverse engineer is the best way you know what's the code there though. – Jason Hu Oct 29 '14 at 13:46
  • Possible duplicate: http://stackoverflow.com/questions/1289881/using-gcc-to-produce-readable-assembly I'd recommend you to try `gcc -fverbose-asm`. Cf. http://panthema.net/2013/0124-GCC-Output-Assembler-Code/ – nodakai Oct 29 '14 at 16:09

1 Answers1

0

Is there any other means of producing mixed C/assembly files so I can isolate the trouble spot in the function?

gcc/gas can generate an assembler listing with C source; I recommend these compiler options:

-g -Wa,-adhln=filename.lst

Armali
  • 18,255
  • 14
  • 57
  • 171