c-source code in assembler listing

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

I'm missing the source code lines within the assembler listing. The gcc call is from my Makefile. The 'rtc8583.lst' does not contain any source code lines.

avr-gcc -c -mmcu=atmega8535 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=rtc8583.lst -std=gnu99 rtc8583.c -o rtc8583.o

Why doesn't the option -Wa,adhlns work how I expect ?

Best regards.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Because the assembler doesn't know anything about high-level language
source code. It's not part of the assembler code generated by the
compiler, thus the assembler could not possibly include it in the list
file.

You might get some luck with the .lss file which is actually a
disassembler listing, where the disassembler (part of avr-objdump)
merges the disassembly with the source code, as indicated by the
debugging information that has been injected by the compiler.
However, there are enough situations where clever optimization rather
tends to not produce contiguous assembly code, so this kind of listing
might always be more confusing than it actually helps. (The more RISC
your CPU is, the more confusing it will be.)

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Jörg,

thanks for your answer.
In the meantime I found, that this behaviour is since I upgraded to WinAVR Version 20050214. The previous Version had the c-source code lines in the listing file, just above the aproppriate assembler statements.
I'm using the same Makefile, same compiler/assembler options.

I guess that something in the avr-gcc tool chain must have been changed.

... avr-objdump could be a workaround for getting a similar listing.

H.-J. Heinrichs

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think you're confusing the .lst and the .lss file.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I think you're confusing the .lst and the .lss file.

I'm sure not to be confused about the two files - .lss file is a disassembly from the elf object. - .lst is an intermediate lisiting file between compiler and assembler.

I've attached two .lst files. 'rtc8583_new.lst.txt' has been created with new WinAVR version. 'rtc8583_old.lst.txt' has been created on Oct, 23rd 2004 with previous WinAVR version.

Please see the differences.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried my own test file and compared the .lst files from GCC 3.3.2 to GCC 3.4.3, and I did not see a change in the listing wrt. dropping the C statements and using the same Makefile.

Can you attach your source code file?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your efforts,

finally I think I've got the difference.
Everything depends on the -g option. The first call with '-g' only does not include c-source into the listing. The second one with '-gstabs' does.

avr-gcc -c -mmcu=atmega8535 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=rtc8583.lst -std=gnu99 rtc8583.c -o rtc8583.o

avr-gcc -c -mmcu=atmega8535 -I. -gstabs -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=rtc8583.lst -std=gnu99 rtc8583.c -o rtc8583.o

My guess is, that the default behaviour of -g has been changed with the new WinAVR/gcc version.

_____________
H.-J. Heinrichs

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What *has* changed is that the default debugging information went from stabs to DWARF2.

It would be interesting to see if there is a difference between -gstabs and -gdwarf-2

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not sure if this was ever answered, but I just ran into this problem of the missing source code.
I was using -gdwarf-2, and that will NOT include the C-source.
Switching to -gstabs, the C-source code was again included.

/Jesper
http://www.yampp.com
The quick black AVR jumped over the lazy PIC.
What boots up, must come down.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jesper,

Was this on code that is loaded above 64K?

Thanks
Eric

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, it was just a 20k program.
I also tried it on a simple test code snippet.
Same problem. The "h" passed to the assembler have no effect with -gdwarf-2 (or with just -g).

/Jesper
http://www.yampp.com
The quick black AVR jumped over the lazy PIC.
What boots up, must come down.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmpf.

I'm very sorry that it no longer works. I guess I'll have to fill in a bug report on GCC.

Eric