D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] gnu compiler experts anywhere?

 

On Wed, 3 Nov 2010, tom wrote:

On 03/11/10 08:26, Simon Waters wrote:
On 03/11/10 08:05, tom wrote:

When I was a lad....
When one compiles for debug these days the exe file is not the same as
the running version that crashes hence the difficulty of finding certain
problems.

It has an extended symbol table compiled into it with references to source code line numbers.

I remember in my youth compiler/linkers making a separate map file that
could be used by the debugger - can the gnu tools do this?

I don't recall the gnu tools ever doing this...

Don't know, probably, but you can run add debugging to optimised code -
the results are "interesting" at times but works well enough and usually
finds problems caused by over optimistic optimisation. Although one
wonders what sort of code you are feeding it to find bugs these days....

bugs in the compiler or code we're compiling :)

http://www.delorie.com/gnu/docs/gdb/gdb_17.html

Its not my code and it uses some dynamic build method which makes it really hard to work out whats what! And apparently I'm looking for symbol files - gdb can take one but I cant see how to generate one...

Sure it's not a core dump file that you're after?

You may need to enable core-file dumping in the shell - I think most distros turn that feature off these days.

e.g.

  gordon @ yakko: cat test.c
  main ()
  {
    int i, j, k ;

    i = 5 ;
    j = 0 ;
    k = i / j ;
  }

  gordon @ yakko: gcc -g test.c
  gordon @ yakko: ./a.out
  Floating exception (core dumped)

  gordon @ yakko: gdb -q a.out core

  warning: Can't read pathname for load map: Input/output error.
  Reading symbols from /lib/i686/cmov/libc.so.6...done.
  Loaded symbols for /lib/i686/cmov/libc.so.6
  Reading symbols from /lib/ld-linux.so.2...done.
  Loaded symbols for /lib/ld-linux.so.2
  Core was generated by `./a.out'.
  Program terminated with signal 8, Arithmetic exception.
  [New process 22138]
  #0  0x080483a1 in main () at test.c:7
  7         k = i / j ;
  (gdb)

Gordon

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq