Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* editing source files in gdb
@ 2006-12-16  8:09 Kiran Pradeep
  2006-12-16  8:21 ` Nick Roberts
  0 siblings, 1 reply; 4+ messages in thread
From: Kiran Pradeep @ 2006-12-16  8:09 UTC (permalink / raw)
  To: gdb

Hi,
     I referred to the  manual on editing source files from inside gdb
using an editor. I gave commands

EDITOR=/usr/bin/vim
export EDITOR
gdb a.out

The problem is that when i give 'edit' from inside gdb to edit the
current source file, gdb is opening a new file in the editor under a
different name. The funny thing is that the new file has the name of
the absolute path of the file with a slash between directory and file
missing. For eg: if file 'test.cpp' is in directory '/home/kiran' then
gdb is opening the file as /home/kirantest.cpp. Could any one help me
in this ?

This feature (coupled with make from inside gdb) would be useful to me
as dont have to exit from gdb for editing the source file if i find a
mistake in my code.

Thanks in advance
Kiran.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: editing source files in gdb
  2006-12-16  8:09 editing source files in gdb Kiran Pradeep
@ 2006-12-16  8:21 ` Nick Roberts
  2006-12-16  9:58   ` Kiran Pradeep
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Roberts @ 2006-12-16  8:21 UTC (permalink / raw)
  To: Kiran Pradeep; +Cc: gdb

 > The problem is that when i give 'edit' from inside gdb to edit the
 > current source file, gdb is opening a new file in the editor under a
 > different name. The funny thing is that the new file has the name of
 > the absolute path of the file with a slash between directory and file
 > missing. For eg: if file 'test.cpp' is in directory '/home/kiran' then
 > gdb is opening the file as /home/kirantest.cpp. Could any one help me
 > in this ?

You don't say what version of GDB this is.  I see what you do for 6.3 but
not GDB in CVS (6.6.50.20061210-cvs).  Perhaps updating to a newer GDB will
solve your problem.

 > This feature (coupled with make from inside gdb) would be useful to me
 > as dont have to exit from gdb for editing the source file if i find a
 > mistake in my code.

As a side note, the mode that I'm writing for Emacs tries to achieve this too.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: editing source files in gdb
  2006-12-16  8:21 ` Nick Roberts
@ 2006-12-16  9:58   ` Kiran Pradeep
  2006-12-16 17:12     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Kiran Pradeep @ 2006-12-16  9:58 UTC (permalink / raw)
  To: gdb

On 12/16/06, Nick Roberts <nickrob@snap.net.nz> wrote:
>  > The problem is that when i give 'edit' from inside gdb to edit the
>  > current source file, gdb is opening a new file in the editor under a
>  > different name. The funny thing is that the new file has the name of
>  > the absolute path of the file with a slash between directory and file
>  > missing. For eg: if file 'test.cpp' is in directory '/home/kiran' then
>  > gdb is opening the file as /home/kirantest.cpp. Could any one help me
>  > in this ?
>
> You don't say what version of GDB this is.  I see what you do for 6.3 but
> not GDB in CVS (6.6.50.20061210-cvs).  Perhaps updating to a newer GDB will
> solve your problem.
>
>  > This feature (coupled with make from inside gdb) would be useful to me
>  > as dont have to exit from gdb for editing the source file if i find a
>  > mistake in my code.
>
> As a side note, the mode that I'm writing for Emacs tries to achieve this too.
>
> --
> Nick                                           http://www.inet.net.nz/~nickrob
>

Thanks a lot. That helped an i can now edit the file from vi from
inside gdb itself.
But is there any thing is gdb that prevents 'vi' from loading my
favourite "vimrc"
(vi startup customization file).


I have one more doubt. I have defined a string like

typedef std::basic_string< unsigned short, unsigned_short_traits > utf16string;
utf16string myString; //dont worry about the traits

Is there any thing in gdb that will help me view the string as i view
a ordinary std::string.

As of now i use [x/100s myString.c_str()] or [p /c
*myString.c_str()@100] to examine the
data in the string. Could i use any thing better to view it like an
ordinary string ?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: editing source files in gdb
  2006-12-16  9:58   ` Kiran Pradeep
@ 2006-12-16 17:12     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-12-16 17:12 UTC (permalink / raw)
  To: Kiran Pradeep; +Cc: gdb

On Sat, Dec 16, 2006 at 03:27:53PM +0530, Kiran Pradeep wrote:
> I have one more doubt. I have defined a string like
> 
> typedef std::basic_string< unsigned short, unsigned_short_traits > 
> utf16string;
> utf16string myString; //dont worry about the traits
> 
> Is there any thing in gdb that will help me view the string as i view
> a ordinary std::string.

Unfortuantely, GDB doesn't have any support for wide character strings
yet.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-16 17:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-16  8:09 editing source files in gdb Kiran Pradeep
2006-12-16  8:21 ` Nick Roberts
2006-12-16  9:58   ` Kiran Pradeep
2006-12-16 17:12     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox