This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix crash on CLI indented comments [Re: [Bug:cli] Loading user-defined function generates an internal error]
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Nick Roberts <nickrob at snap dot net dot nz>, gdb at sourceware dot org, gdb-patches at sourceware dot org
- Date: Fri, 1 Jan 2010 14:35:20 +0400
- Subject: Re: [patch] Fix crash on CLI indented comments [Re: [Bug:cli] Loading user-defined function generates an internal error]
- References: <19258.59036.731093.439412@totara.tehura.co.nz> <20091230054617.GA548@adacore.com> <19259.54163.166299.854635@totara.tehura.co.nz> <20100101084028.GA29969@host0.dyn.jankratochvil.net>
> 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