This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix crash on CLI indented comments [Re: [Bug:cli] Loading user-defined function generates an internal error]


> 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
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]