emacs-devel
[Top][All Lists]
Advanced

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

Re: new gdb/gdba code has bug with absolute source filenames


From: Nick Roberts
Subject: Re: new gdb/gdba code has bug with absolute source filenames
Date: Thu, 8 Jan 2004 10:21:47 +0000

 > > Bruce, when you see the assembler code for main rather than C source code
 > > what does GDB say when you type "info source" in the GUD buffer?
 > 
 > It says:
 > 
 > (gdb) info source
 > Current source file is /tmp/hello.c
 > Located in /tmp/hello.c
 > Contains 6 lines.
 > Source language is c.
 > Compiled with DWARF 2 debugging format.
 > Includes preprocessor macro info.

Emacs doesn't find the source because "info source" doesn't output
the line with the compilation directory. Compare this with:

 > Current source file is hello.c
 > Compilation directory is /tmp   <-
 > Located in /tmp/hello.c
 > Contains 6 lines.
 > Source language is c.
 > Compiled with DWARF 2 debugging format.
 > Includes preprocessor macro info.

I don't know if this is a bug in gdb or gcc or normal output. I don't see why
gdb can't find the compilation directory from the executable. You used 
gcc version 3.3.3, is that a stable version?

 > Perhaps I'm being naive, but it looks to me like gdb-source-info ought
 > to be looking at "Located in ..." and just believing it.  (Possibly
 > this wouldn't work for Windows or older gdbs or something.)

It *does* use "Located in ...". Below is a patch that should work in your
case. I'm not sure whether I should commit it to the repository though.


    Nick                                         http://www.nick.uklinux.net



*** gdb-ui.el.~1.54.~   2004-01-07 23:04:35.000000000 +0000
--- gdb-ui.el   2004-01-08 10:09:17.000000000 +0000
***************
*** 1706,1719 ****
  buffers."
    (goto-char (point-min))
    (if (search-forward "directory is " nil t)
!       (progn
!       (if (looking-at "\\S-*:\\(\\S-*\\)")
!           (setq gdb-cdir (match-string 1))
!         (looking-at "\\S-*")
!         (setq gdb-cdir (match-string 0)))
!       (search-forward "Located in ")
        (looking-at "\\S-*")
!       (setq gdb-main-file (match-string 0)))
      (setq gdb-view-source nil))
    (delete-other-windows)
    (switch-to-buffer gud-comint-buffer)
--- 1706,1718 ----
  buffers."
    (goto-char (point-min))
    (if (search-forward "directory is " nil t)
!       (if (looking-at "\\S-*:\\(\\S-*\\)")
!         (setq gdb-cdir (match-string 1))
        (looking-at "\\S-*")
!       (setq gdb-cdir (match-string 0))))
!   (if (search-forward "Located in " nil t)
!       (if (looking-at "\\S-*")
!         (setq gdb-main-file (match-string 0)))
      (setq gdb-view-source nil))
    (delete-other-windows)
    (switch-to-buffer gud-comint-buffer)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]