From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sanjeev Kumar.S" Newsgroups: gmane.emacs.help Subject: Re: kgdb in emacs Date: Sun, 27 Jan 2008 02:17:36 -0800 (PST) Message-ID: <175841.40216.qm@web57709.mail.re3.yahoo.com> References: <18332.19879.672102.308829@kahikatea.snap.net.nz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0537507443==" X-Trace: ger.gmane.org 1201429092 5190 80.91.229.12 (27 Jan 2008 10:18:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Jan 2008 10:18:12 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Nick Roberts Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 27 11:18:31 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JJ4as-0007sq-8A for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Jan 2008 11:18:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJ4aR-0007u8-DI for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Jan 2008 05:18:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJ4a3-0007u3-Q7 for help-gnu-emacs@gnu.org; Sun, 27 Jan 2008 05:17:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJ4a2-0007tr-S6 for help-gnu-emacs@gnu.org; Sun, 27 Jan 2008 05:17:39 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJ4a2-0007to-Ip for help-gnu-emacs@gnu.org; Sun, 27 Jan 2008 05:17:38 -0500 Original-Received: from web57709.mail.re3.yahoo.com ([68.142.236.72]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JJ4a2-00006G-BS for help-gnu-emacs@gnu.org; Sun, 27 Jan 2008 05:17:38 -0500 Original-Received: (qmail 41214 invoked by uid 60001); 27 Jan 2008 10:17:37 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=RAUxnRmyZfHqzMp3W7g8Q2xSPx+LjUNZ7nv8fzUgydTApZfxo+yZmun9OczbOEBkTmonWq4BAHXCu+awymfHJvMjzkB1waiK4QMhGK6Ps2RZvgbGGtA7n+wmqiNchWSQbpTDRf6DrIAxt6Nwxn57qEvHLP6kKIzZSVMe8npwUIc=; X-YMail-OSG: 9sOSBC0VM1nGtfzH_NYbXxbJ_6V9gSV6gBsSSngXb7jMR7_tg8a4lJLcrIGc9kjvY0VaxBD3YWTer_Offtm67azSDr9O3Okhui5CH.3SYA4t8uh8Ug-- Original-Received: from [210.68.188.20] by web57709.mail.re3.yahoo.com via HTTP; Sun, 27 Jan 2008 02:17:36 PST In-Reply-To: <18332.19879.672102.308829@kahikatea.snap.net.nz> X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:51006 Archived-At: --===============0537507443== Content-Type: multipart/alternative; boundary="0-1340799693-1201429056=:40216" Content-Transfer-Encoding: 8bit --0-1340799693-1201429056=:40216 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit I will answer your questions from the beginning: > When can you use gdb -k? > With the latest GDB from CVS, I get: > $ gdb -k > gdb: unrecognized option `-k' I believe in newer versions of bsd release we've moved from "bsd -k" to kgdb. I don't know why this decision was made. Maybe its for some simple reason but I haven't poked around it. > Run gdb ( like this ) : kgdb -a -a -a kernel.debug > (kgdb) target remote /dev/cuad0 kgdb requires either a core file or a device file for remote debugging. If we issue this command on a local machine this behavior is pretty straightforward, with no quirkiness. > I guess you mean Emacs now parses your command line now. > But presumably you still get *gud-cuad0* in the mode-line of the GUD > buffer. Yes. I get the above, but is that an issue ? > Does kgdb work like gdb? yes it works like gdb. In its full glory. > Is "target remote /dev/cuad0" a valid kgdb command? Again, I was not able to get to this point without specifying the complete set of arguments while starting. ie. to start i need to specify -r and the debug file. without that i was not able to start it up. > Run gdb ( like this ) : kgdb -a -a -a -r /dev/cuad0 kernel.debug Just -a works for me. "-a -a" or "-a -a -a" and I get some garbled output on the screen. But still I have an issue, I have to press a "n" or "s" to get emacs to display the source file. Any way around it ? > One last thing, if you do get it to work well, please e-mail me what you > have learnt so that I can add it to my homepage. Yes...I will do this. I will make a complete document and give one copy to you and one to the Freebsd doc team. But I will try and get as much questions resolved in the document, so no one has to waste almost a day figuring it out like me. Regards, Sanjeev. Nick Roberts wrote: > Thank you very much Nick, Your clue of emacs version prompted me > to upgrade my emacs. after which I'm able to do it. I guess you mean Emacs now parses your command line now. But presumably you still get *gud-cuad0* in the mode-line of the GUD buffer. > BTW, my earlier emacs version was 21.2.4 and now it is 22.0.50.1 > > One more question: I'm still not able to open the file another emacs > window. I thought this was supposed happen automatically. In other > instances of emacs ( like when debugging apps ) the source code file > opens automatically in another emacs window ( vertical split style). I have some more thoughts but you need to answer my questions for good communication. Does kgdb work like gdb? Is "target remote /dev/cuad0" a valid kgdb command? > Even if it doesn't, when I enter "f" it opens up automatically. For the source to appear gdb/kgdb must output annotations. In gdb, this requires "--fullname" or "-annotate=1" for text mode and "-annotate=3" for graphical mode. In Emacs 21 "--fullname" was used but was not visible to the user. In Emacs 22, running an app like this: Run gdb (like this): gdb myprog won't display the source, but: Run gdb (like this): gdb -annotate=3 myprog will. Likewise, I suspect Run gdb ( like this ) : kgdb -r /dev/cuad0 kernel.debug won't display the source, but: Run gdb ( like this ) : kgdb -a -a -a -r /dev/cuad0 kernel.debug will. > One possibility is, though i changed the emacs current directory > to /usr/obj/usr/src/sys/MYKERNEL/ , the -r /dev/cuad0 option would have > changed the default directory, as evident in the file line when a gud > window is opened: > Current directory is /dev/ > :( You really want to find another way of specifying the arguments along the lines that I suggested, so that the directory doesn't change and you get *gud-kernel.debug* in the mode-line of the GUD buffer. However, I think another way to stop the current directory from changing is to set gud-chdir-before-run to nil. One last thing, if you do get it to work well, please e-mail me what you have learnt so that I can add it to my homepage. Thanks, Nick http://www.inet.net.nz/~nickrob --------------------------------- Never miss a thing. Make Yahoo your homepage. --0-1340799693-1201429056=:40216 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit I will answer your questions from the beginning:

> When can you use gdb -k?
> With the latest GDB from CVS, I get:
> $ gdb -k
> gdb: unrecognized option `-k'
I believe in newer versions of bsd release we've moved from
"bsd -k" to  kgdb. I don't know why this decision was made. Maybe
its for some simple reason but I haven't poked around it.
> Run gdb ( like this ) : kgdb -a -a -a kernel.debug
> (kgdb) target remote /dev/cuad0

kgdb requires either a core file or a device file for remote
debugging. If we issue this command on a local machine this
behavior is pretty straightforward, with no quirkiness.

> I guess you mean Emacs now parses your command line now.

& gt; But presumably you still get *gud-cuad0* in the mode-line of the GUD
> buffer.
Yes. I get the above, but is that an issue ?

> Does kgdb work like gdb?
yes it works like gdb. In its full glory.

> Is "target remote /dev/cuad0" a valid kgdb command?

Again, I was not able to get to this point without specifying the
complete set of arguments while starting. ie. to start i need to specify
-r and the debug file. without that i was not able to start it up.

> Run gdb ( like this ) : kgdb -a -a -a -r /dev/cuad0 kernel.debug

Just -a works for me. "-a -a" or "-a -a -a" and I get some garbled output
on the screen. But still I have an issue, I have to press a "n" or "s" to
get emacs to display the source file. Any way around it ?

> One last thing, if you do get it to work well, please e-mail me what you
> have learnt so that I can add it to my homepage.

Yes...I will do this. I will ma ke a complete document and give one copy
to you and one to the Freebsd doc team. But I will try and get as much
questions resolved in the document, so no one has to waste almost
a day figuring it out like me.

Regards,
Sanjeev.

Nick Roberts <nickrob@snap.net.nz> wrote:
> Thank you very much Nick, Your clue of emacs version prompted me
> to upgrade my emacs. after which I'm able to do it.

I guess you mean Emacs now parses your command line now.

But presumably you still get *gud-cuad0* in the mode-line of the GUD
buffer.

> BTW, my earlier emacs version was 21.2.4 and now it is 22.0.50.1
>
> One more question: I'm still not able to open the file another emacs
> window. I thought this was supposed happen automatically. In other
> instances of emacs ( lik e when debugging apps ) the source code file
> opens automatically in another emacs window ( vertical split style).

I have some more thoughts but you need to answer my questions for good
communication.

Does kgdb work like gdb?
Is "target remote /dev/cuad0" a valid kgdb command?

> Even if it doesn't, when I enter "f" it opens up automatically.

For the source to appear gdb/kgdb must output annotations. In gdb, this
requires "--fullname" or "-annotate=1" for text mode and "-annotate=3"
for graphical mode. In Emacs 21 "--fullname" was used but was not visible
to the user.

In Emacs 22, running an app like this:

Run gdb (like this): gdb myprog

won't display the source, but:

Run gdb (like this): gdb -annotate=3 myprog

will. Likewise, I suspect

Run gdb ( like this ) : kgdb -r /dev/cuad0 kernel.debug

won't display the source, but:

Run gdb ( like this ) : k gdb -a -a -a -r /dev/cuad0 kernel.debug

will.

> One possibility is, though i changed the emacs current directory
> to /usr/obj/usr/src/sys/MYKERNEL/ , the -r /dev/cuad0 option would have
> changed the default directory, as evident in the file line when a gud
> window is opened:
> Current directory is /dev/
> :(

You really want to find another way of specifying the arguments along the lines
that I suggested, so that the directory doesn't change and you get
*gud-kernel.debug* in the mode-line of the GUD buffer. However, I think
another way to stop the current directory from changing is to set
gud-chdir-before-run to nil.

One last thing, if you do get it to work well, please e-mail me what you
have learnt so that I can add it to my homepage.

Thanks,

Nick http://www.inet.net.nz/~nickrob


Never miss a thing. Make Yahoo your homepage. --0-1340799693-1201429056=:40216-- --===============0537507443== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --===============0537507443==--