Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb v7.0 - user defined command's document section - space prefixed  end
@ 2009-10-28  6:12 James Pandavan
  2009-11-03 14:33 ` Joel Brobecker
  0 siblings, 1 reply; 14+ messages in thread
From: James Pandavan @ 2009-10-28  6:12 UTC (permalink / raw)
  To: gdb

Hi,

I noticed some of my user defined commands defined in '.gdbinit' file 
stopped working in gdb v7.0. They used to work in gdb v6.8. In trying to 
troubleshoot, I went through the gdb source code.

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      }

So, removing all leading white spaces in line containing 'end' fixed my 
problem for v7.0.

Assuming v7.0's has the correct and intended behavior (as it appears to 
be so), shouldn't the document mention it?
(http://sourceware.org/gdb/current/onlinedocs/gdb_24.html#SEC249) Or am 
I referring to wrong document?

Thanks,
James Pandavan


My gdbinit 
file------------------------------------------------------------------------------------------------------------

|define enable_only
    disable
    enable $arg0
    end
document enable_only
   enables only the given breakpoint
   end

define sstep
    finish
    step
    end
|


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

end of thread, other threads:[~2009-11-18 20:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-28  6:12 gdb v7.0 - user defined command's document section - space prefixed end James Pandavan
2009-11-03 14:33 ` Joel Brobecker
2009-11-03 18:58   ` James Pandavan
2009-11-03 19:43     ` Joel Brobecker
2009-11-03 19:51       ` Daniel Jacobowitz
2009-11-03 22:03         ` Jim Ingham
2009-11-06 21:42         ` Vladimir Prus
2009-11-06 21:49           ` Daniel Jacobowitz
2009-11-07  1:14             ` Vladimir Prus
2009-11-13 23:41               ` Daniel Jacobowitz
2009-11-19  7:17                 ` Vladimir Prus
2009-11-04 20:47       ` Tom Tromey
2009-11-04 21:07         ` Paul Koning
2009-11-04 21:18           ` Joel Brobecker

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