gdb doesn't read user-defined commands from .gdbinit

Bug #461594 reported by Jason Kraftcheck
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdb
New
Low
gdb (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

Binary package hint: gdb

After gdb starts, only the first of about 15 custom commands defined in the attached .gdbinit file are actually defined in gdb. If I comment out the first one, then only the second is defined, etc.

ProblemType: Bug
Architecture: i386
Date: Mon Oct 26 19:50:12 2009
DistroRelease: Ubuntu 9.10
Package: gdb 7.0-0ubuntu1
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-14.48-generic
SourcePackage: gdb
Uname: Linux 2.6.31-14-generic i686

Revision history for this message
Jason Kraftcheck (kraftche) wrote :
Revision history for this message
James Pandavan (james-pandavan) wrote :

I can confirm this issue.

Changed in gdb (Ubuntu):
status: New → Confirmed
Revision history for this message
James Pandavan (james-pandavan) wrote :

I was able to trace the issue. The newer version of gdb expects document's matching 'end' to start from the first column.

Remove all end spaces before every 'end' (document's end). Your gdbinit file would work.

Changed in gdb (Ubuntu):
assignee: nobody → James Pandavan (james-pandavan)
status: Confirmed → In Progress
Changed in gdb (Ubuntu):
assignee: James Pandavan (james-pandavan) → nobody
assignee: nobody → James Pandavan (james-pandavan)
Revision history for this message
James Pandavan (james-pandavan) wrote :

This is an upstream issue.

Nothing to be patched on Ubuntu repository.

Changed in gdb (Ubuntu):
assignee: James Pandavan (james-pandavan) → nobody
Revision history for this message
In , James Pandavan (james-pandavan) wrote :

Some of my gdbinit user defined commands stoped working on v7.0 (they used to
work on v6.8). I found the following to be the cause.

In gdb v6.8, the init file processing logic was in
cli/cli-script.c:read_next_line(). The following code ignores all leading (and
trailing) spaces.

  841 /* Strip leading and trailing whitespace. */
  842 while (*p == ' ' || *p == '\t')
  843 p++;
  844 845 p1 = p + strlen (p);
  846 while (p1 != p && (p1[-1] == ' ' || p1[-1] == '\t'))
  847 p1--;

In gdb v7.0, the processing logic was in cli/cli-script.c:process_next_line().
Apparently, the leading spaces are ignored only for commands and not for
comments. So, if I had a comment section with and 'end' having prefixed spaces,
gdb did not treat it as end of comment section.

  888 if (parse_commands)
  889 {
  890 /* Strip leading whitespace. */
  891 while (*p == ' ' || *p == '\t')
  892 p++;
  893 }

Revision history for this message
James Pandavan (james-pandavan) wrote :
Matthias Klose (doko)
Changed in gdb (Ubuntu):
status: In Progress → Confirmed
Changed in gdb:
status: Unknown → New
Changed in gdb:
importance: Unknown → Low
Matthias Klose (doko)
Changed in gdb (Ubuntu):
importance: Undecided → Wishlist
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.