Re: [Mspgcc-users] Creating .lst files with C code

2010-07-05 Thread JMGross
Von: Grant Edwards
Gesendet am: 02 Jul 2010 16:27:35

 It has, however, some serious drawbacks.

 As in it doesn't work?  :)

Well this IS a drawback, isn't it? :)

 Generating source listings from a linked program using objdump has
 never worked for any target architecture I've tried.  IMO, you're
 beating your head against the wall trying to generate source listings
 with objdump.

The feature is there, so it was (once) supposed to work.

 Generating them for individual files by passing appropriate flags to
 the assembler has always worked on all the architectures I've used
 (though I can't vouce for gcc 4.x on the '430, it works fine with
 3.x).

Yes, and for debugging separate object files, this is okay.
However, the relocations are not done (of course) and the resulting
positions of the code are sometimes important.
It is possible to use just the assembly listing and the individual
object file listing, yet it is also possible to write complex programs in 
plain assembly language but this is no reason to not use a high-
level language such as C. :)

 If I switch on some more info in the global .lst, the comments show
 'File a, line x' yet the source code is from file b, line x or even
 line y. So the info is there (File a line x would be correct). Even
 the path of file a is shown correctly (so using VPATH is not 
 aproblem) But then somehow things get messed up. Seems that objdump
 is unable to extract line x in file a and extracts line y from file b
 instead.

 Based on how completly it's broken and how long it's been that way, I
 assumed that it wasn't supposed to work...

Since the source file and its complete path is known as well as the
correct line number (it's properly included into the listing),
there is no reason why the included source line
is almost completely random. And it shouln't be difficult to fix.
A Filename with path, a line number, that's C for beginners.
Maybe just nobody cared for fixing it (even if it should be easy),
maybe because of more importan bugs, and when these were fixed,
none of the programmers remembered the bug anymore and the
users had accepted it and resigned.

I'd do it myself if I had a linux machine and the proper tools.
Yet my company has given me a windows machine and the only
programming tools are MSPGCC, AVRGCC and VisualC++.
And I have different hobbies than programming in my spare time too :)




Re: [Mspgcc-users] Creating .lst files with C code

2010-07-02 Thread JMGross
Von: N. Coesel
Gesendet am: 01 Jul 2010 14:19:57

 I too use objdump to generate a complete project listing from the elf
 file.
 It has, however, some serious drawbacks. Not only that jumps and calls
 are not printed with their symbolic name, also the source code in the
 listing
 is sometimes (often) from a completely different file or from different
 lines of the same file. So it is virtually useless.

AFAIK this is the result of compiling with optimisation on. If you want a 
proper
list file with source code mixed in, you should compile without optimisation 
(-O0) and with full
debugging enabled (IIRC -g3). At least thats how it works for me when using 
GCC in general.

No, its not an optimization problem. The individual .lst files of the object 
files are fine.
Sometimes, the source is a bit mangled by optimization, (and sometimes, the
assembler will show som boguse unreachable code warnings too due to 
optimization,
but in general it fits. At least the source is form the same function.
But in the global .lst file that objdump generates, the source code is a real 
mess.
I can't find a pattern too. Sometimes the source code is okay,
somethimes it is a completely different part of the right file, sometimes it is
from a completely different source file not related to the code at all.

If I switch on some more info in the global .lst, the comments show
'File a, line x' yet the source code is from file b, line x or even line y.
So the info is there (File a line x would be correct).
Even the path of file a is shown correctly (so using VPATH is not  aproblem)
But then somehow things get messed up. Seems that objdump is unable
to extract line x in file a and extracts line y from file b instead.

JMGross




Re: [Mspgcc-users] Creating .lst files with C code

2010-07-02 Thread Grant Edwards
On 2010-07-02, JMGross msp...@grossibaer.de wrote:
 Von: N. Coesel
 Gesendet am: 01 Jul 2010 14:19:57

 I too use objdump to generate a complete project listing from the elf
 file.

I've never seen that work except for extremely trivial programs.

 It has, however, some serious drawbacks.

As in it doesn't work?  :)

 Not only that jumps and calls are not printed with their symbolic
 name, also the source code in the listing is sometimes (often) from a
 completely different file or from different lines of the same file.
 So it is virtually useless.

AFAIK this is the result of compiling with optimisation on. If you
want a proper list file with source code mixed in, you should compile
without optimisation (-O0) and with full debugging enabled (IIRC -g3).
At least thats how it works for me when using GCC in general.

 No, its not an optimization problem. The individual .lst files of the
 object files are fine. Sometimes, the source is a bit mangled by
 optimization, (and sometimes, the assembler will show som boguse
 unreachable code warnings too due to optimization, but in general it
 fits. At least the source is form the same function. But in the
 global .lst file that objdump generates, the source code is a real
 mess.

Generating source listings from a linked program using objdump has
never worked for any target architecture I've tried.  IMO, you're
beating your head against the wall trying to generate source listings
with objdump.

Generating them for individual files by passing appropriate flags to
the assembler has always worked on all the architectures I've used
(though I can't vouce for gcc 4.x on the '430, it works fine with
3.x).

 I can't find a pattern too. Sometimes the source code is okay,
 somethimes it is a completely different part of the right file,
 sometimes it is from a completely different source file not related
 to the code at all.

That's the behaivior I've always seen when trying to generate source
listings using objdump.

 If I switch on some more info in the global .lst, the comments show
 'File a, line x' yet the source code is from file b, line x or even
 line y. So the info is there (File a line x would be correct). Even
 the path of file a is shown correctly (so using VPATH is not 
 aproblem) But then somehow things get messed up. Seems that objdump
 is unable to extract line x in file a and extracts line y from file b
 instead.

Based on how completly it's broken and how long it's been that way, I
assumed that it wasn't supposed to work...

-- 
Grant Edwards   grant.b.edwardsYow! I have accepted
  at   Provolone into my life!
  gmail.com




Re: [Mspgcc-users] Creating .lst files with C code

2010-07-01 Thread JMGross


I too use objdump to generate a complete project listing from the elf file.
It has, however, some serious drawbacks. Not only that jumps and calls
are not printed with their symbolic name, also the source code in the listing
is sometimes (often) from a completely different file or from different
lines of the same file. So it is virtually useless.
I guess the problem is related to the fact that I do not compile into
the source folder (but into a /bin subdir) and also compile code from a
common folder.

The .lst ifles directly generated by the compiler with the option
-Wa,-ahlms=$(addprefix $(OBJDIR)/,$(notdir $(:.c=.lst)))
is fine. Of course the compiler knows the correct source :)
Yet I use mspgcc 3, not 4.

JMGross


On 2010-06-30, Diane Gagne drose.ga...@gmail.com wrote:

I am in the process of moving from mspgcc 3.2.3 to mspgcc4, but I am having
trouble with the creation of the .lst files.  When my source is compiled
with the 3.2.3 the list files have the C code printed in them along with the
assembly.  Using the same makefile, and compiling with the mspgcc4 the C
code goes away which makes it harder to read.

I realize that objdump will give me close to what I am looking for, but
those files do not have the jumps listed.

Is there a way to get the C code back, maybe a default option changed that I
do not realize?




Re: [Mspgcc-users] Creating .lst files with C code

2010-07-01 Thread Hans Nieuwenhuis
I noticed the missing C source in mspgcc4 too a while ago. There is a
difference between mspgcc3 and mspgcc4 in this area. But it could also
be the underlying binutils which cause this behaviour. 
Just tried to compile an ordinary X86 program using GCC 4.4.3 on Ubuntu
with these options:

CFLAGS += -Wa,-adhlns=$(subst $(suffix $),.lst,$) 

This one gives me listing with C source mixed. It looks like a mspgcc
issue. Mspgcc4 has an additional -Xassembler arg option, but that one
has the same behaviour.

Regards,

Hans

On Thu, 1 Jul 2010 12:42:24 +0200
JMGross msp...@grossibaer.de wrote:

 
 
 I too use objdump to generate a complete project listing from the elf file.
 It has, however, some serious drawbacks. Not only that jumps and calls
 are not printed with their symbolic name, also the source code in the listing
 is sometimes (often) from a completely different file or from different
 lines of the same file. So it is virtually useless.
 I guess the problem is related to the fact that I do not compile into
 the source folder (but into a /bin subdir) and also compile code from a
 common folder.
 
 The .lst ifles directly generated by the compiler with the option
 -Wa,-ahlms=$(addprefix $(OBJDIR)/,$(notdir $(:.c=.lst)))
 is fine. Of course the compiler knows the correct source :)
 Yet I use mspgcc 3, not 4.
 
 JMGross
 
 
 On 2010-06-30, Diane Gagne drose.ga...@gmail.com wrote:
 
 I am in the process of moving from mspgcc 3.2.3 to mspgcc4, but I am having
 trouble with the creation of the .lst files.  When my source is compiled
 with the 3.2.3 the list files have the C code printed in them along with the
 assembly.  Using the same makefile, and compiling with the mspgcc4 the C
 code goes away which makes it harder to read.
 
 I realize that objdump will give me close to what I am looking for, but
 those files do not have the jumps listed.
 
 Is there a way to get the C code back, maybe a default option changed that I
 do not realize?
 
 
 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Mspgcc-users mailing list
 Mspgcc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mspgcc-users



Re: [Mspgcc-users] Creating .lst files with C code

2010-07-01 Thread N. Coesel
- Original Message - 
From: JMGross msp...@grossibaer.de

To: MSPGCC mailing list, mspgcc-users@lists.sourceforge.net
Sent: Thursday, July 01, 2010 12:42 PM
Subject: Re: [Mspgcc-users] Creating .lst files with C code





I too use objdump to generate a complete project listing from the elf
file.
It has, however, some serious drawbacks. Not only that jumps and calls
are not printed with their symbolic name, also the source code in the
listing
is sometimes (often) from a completely different file or from different
lines of the same file. So it is virtually useless.


AFAIK this is the result of compiling with optimisation on. If you want a 
proper
list file with source code mixed in, you should compile without optimisation 
(-O0) and with full
debugging enabled (IIRC -g3). At least thats how it works for me when using 
GCC in general.


Nico Coesel




Re: [Mspgcc-users] Creating .lst files with C code

2010-07-01 Thread Hans Nieuwenhuis
On Thu, 1 Jul 2010 14:19:57 +0200
N. Coesel n...@nctdev.nl wrote:

 
 AFAIK this is the result of compiling with optimisation on. If you want a 
 proper
 list file with source code mixed in, you should compile without optimisation 
 (-O0) and with full
 debugging enabled (IIRC -g3). At least thats how it works for me when using 
 GCC in general.
 

No, does not work for me on mspgcc4. X86 gcc4 gives me c source
intermixed even with -O2 and just -g. On mspgcc3 I use -Os and -g with
the expected results.
Of course you can question the usefulness of source and assembly
mixing using -O2, but that's another subject.

Regards,

Hans

 Nico Coesel
 
 
 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Mspgcc-users mailing list
 Mspgcc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mspgcc-users



Re: [Mspgcc-users] Creating .lst files with C code

2010-07-01 Thread Peter Bigot
Excellent; thank you.  With this help I've determined that the msp430
patches to gcc don't enable the check for dwarf2 support on that
architecture; as a result the compiler won't generate the line information
required for integrated listings.  This is probably why another user has
complained that gdb can't find file locations.

I've verified that a patch to gcc's configure script changes the
configuration so the proper symbols are defined.   I'll do additional
testing, see if there are other features that aren't being supported because
of a similar problem, and get it into the mspgcc4 git repository and push
the patch upstream to the primary mspgcc4 maintainers for release.

It should be available for builds from the git repository by Friday morning;
I can't speak to when it'll be available in svn or as pre-built packages.

Peter

On Thu, Jul 1, 2010 at 7:11 AM, Hans Nieuwenhuis vz...@xs4all.nl wrote:

 I noticed the missing C source in mspgcc4 too a while ago. There is a
 difference between mspgcc3 and mspgcc4 in this area. But it could also
 be the underlying binutils which cause this behaviour.
 Just tried to compile an ordinary X86 program using GCC 4.4.3 on Ubuntu
 with these options:

 CFLAGS += -Wa,-adhlns=$(subst $(suffix $),.lst,$)

 This one gives me listing with C source mixed. It looks like a mspgcc
 issue. Mspgcc4 has an additional -Xassembler arg option, but that one
 has the same behaviour.

 Regards,

 Hans

 On Thu, 1 Jul 2010 12:42:24 +0200
 JMGross msp...@grossibaer.de wrote:

 
 
  I too use objdump to generate a complete project listing from the elf
 file.
  It has, however, some serious drawbacks. Not only that jumps and calls
  are not printed with their symbolic name, also the source code in the
 listing
  is sometimes (often) from a completely different file or from different
  lines of the same file. So it is virtually useless.
  I guess the problem is related to the fact that I do not compile into
  the source folder (but into a /bin subdir) and also compile code from a
  common folder.
 
  The .lst ifles directly generated by the compiler with the option
  -Wa,-ahlms=$(addprefix $(OBJDIR)/,$(notdir $(:.c=.lst)))
  is fine. Of course the compiler knows the correct source :)
  Yet I use mspgcc 3, not 4.
 
  JMGross
 
 
  On 2010-06-30, Diane Gagne drose.ga...@gmail.com wrote:
 
  I am in the process of moving from mspgcc 3.2.3 to mspgcc4, but I am
 having
  trouble with the creation of the .lst files.  When my source is compiled
  with the 3.2.3 the list files have the C code printed in them along with
 the
  assembly.  Using the same makefile, and compiling with the mspgcc4 the C
  code goes away which makes it harder to read.
 
  I realize that objdump will give me close to what I am looking for, but
  those files do not have the jumps listed.
 
  Is there a way to get the C code back, maybe a default option changed
 that I
  do not realize?
 
 
 
 --
  This SF.net email is sponsored by Sprint
  What will you do first with EVO, the first 4G phone?
  Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
  ___
  Mspgcc-users mailing list
  Mspgcc-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/mspgcc-users


 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Mspgcc-users mailing list
 Mspgcc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/mspgcc-users



Re: [Mspgcc-users] Creating .lst files with C code

2010-06-30 Thread Grant Edwards
On 2010-06-30, Diane Gagne drose.ga...@gmail.com wrote:

 I am in the process of moving from mspgcc 3.2.3 to mspgcc4, but I am
 having trouble with the creation of the .lst files.  When my source
 is compiled with the 3.2.3 the list files have the C code printed in
 them along with the assembly.  Using the same makefile, and compiling
 with the mspgcc4 the C code goes away which makes it harder to read.

 I realize that objdump will give me close to what I am looking for,
 but those files do not have the jumps listed.

 Is there a way to get the C code back, maybe a default option changed
 that I do not realize?

Can you give us a hint as to what options are you using to generate
the listing?

-- 
Grant Edwards   grant.b.edwardsYow! I just remembered
  at   something about a TOAD!
  gmail.com