unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nick Roberts <nick@nick.uklinux.net>
Cc: Andreas Schwab <schwab@suse.de>, emacs-devel@gnu.org
Subject: Re: new gdb/gdba code has bug with absolute source filenames
Date: Thu, 8 Jan 2004 10:21:47 +0000	[thread overview]
Message-ID: <16381.12091.162795.324113@nick.uklinux.net> (raw)
In-Reply-To: <84vfnnb73l.fsf@cenderis.demon.co.uk>

 > > 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	other threads:[~2004-01-08 10:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07 22:43 new gdb/gdba code has bug with absolute source filenames Nick Roberts
2004-01-08  0:46 ` Bruce Stephens
2004-01-08 10:21   ` Nick Roberts [this message]
2004-01-08 11:11     ` Bruce Stephens
2004-01-08 10:27   ` Andreas Schwab
2004-01-08 11:04     ` Bruce Stephens
2004-01-08 10:21 ` Andreas Schwab
2004-01-08 12:28   ` Nick Roberts
2004-01-08 13:53     ` Bruce Stephens
  -- strict thread matches above, loose matches on Subject: below --
2004-01-08 22:04 Nick Roberts
2004-01-06 17:05 Bruce Stephens
2004-01-06 20:40 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16381.12091.162795.324113@nick.uklinux.net \
    --to=nick@nick.uklinux.net \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).