Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Nick Roberts <nickrob@snap.net.nz>,
	gdb@sourceware.org, 	gdb-patches@sourceware.org
Subject: Re: [patch] Fix crash on CLI indented comments  [Re: [Bug:cli]  Loading user-defined function generates an internal  error]
Date: Fri, 01 Jan 2010 10:36:00 -0000	[thread overview]
Message-ID: <20100101103520.GR2788@adacore.com> (raw)
In-Reply-To: <20100101084028.GA29969@host0.dyn.jankratochvil.net>

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

> 2010-01-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	* cli/cli-script.c (process_next_line): Check P2 overrun.

Yes - I agree it's obvious when you know that the comment is stripped
upstream...

Approved. Thanks for fixing.

Given the number of regressions/failures we've seen in this area,
I really thought we should add a test for this, so I created
the attached patch.  I will commit after you have committed yours.

gdb/testsuite/

        Test indented comment in file being sourced.
        * commands.exp: Test indented comment in file being sourced.

Tested on x86_64-linux.  Fails miserably without Jan's patch.

-- 
Joel

[-- Attachment #2: test-indented-comment.diff --]
[-- Type: text/x-diff, Size: 1246 bytes --]

commit 0f79c42a551762d87088fd5916c4ed390dde9942
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Fri Jan 1 14:31:07 2010 +0400

    Test indented comment in file being sourced.
    
            * commands.exp: Test indented comment in file being sourced.

diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 2aba51f..228c464 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -577,6 +577,19 @@ proc stray_arg0_test { } {
 	"stray_arg0_test #4"
 }
 
+# Test that GDB is able to source a file with an indented comment.
+proc source_file_with_indented_comment {} {
+    set fd [open "file1" w]
+    puts $fd \
+{define my_fun
+    #indented comment
+end
+echo Done!\n}
+    close $fd
+
+    gdb_test "source file1" "Done!" "source file with indented comment"
+}
+
 # Test that GDB can handle arguments when sourcing files recursively.
 # If the arguments are overwritten with ####### then the test has failed.
 proc recursive_source_test {} {
@@ -761,6 +774,7 @@ deprecated_command_test
 bp_deleted_in_command_test
 temporary_breakpoint_commands
 stray_arg0_test
+source_file_with_indented_comment
 recursive_source_test
 if_commands_test
 redefine_hook_test

  reply	other threads:[~2010-01-01 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19258.59036.731093.439412@totara.tehura.co.nz>
     [not found] ` <20091230054617.GA548@adacore.com>
     [not found]   ` <19259.54163.166299.854635@totara.tehura.co.nz>
2010-01-01  8:41     ` Jan Kratochvil
2010-01-01 10:36       ` Joel Brobecker [this message]
2010-01-01 11:01         ` Jan Kratochvil
2010-01-01 11:12         ` Joel Brobecker

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

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

  git send-email \
    --in-reply-to=20100101103520.GR2788@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gdb@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=nickrob@snap.net.nz \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox