From: Doug Evans Date: Sat, 22 Mar 2014 06:44:39 +0000 (-0400) Subject: * extension.c (eval_ext_lang_from_control_command): Avoid dereferencing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=feef67abfaf328082c445b9d25696d44551478d1;p=binutils-gdb.git * extension.c (eval_ext_lang_from_control_command): Avoid dereferencing NULL pointer. testsuite/ * gdb.python/python.exp (python not supported): Verify multi-line python command issues an error. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0aec7b92304..a1e8c34a3f1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-03-21 Daniel Gutson + + * extension.c (eval_ext_lang_from_control_command): Avoid dereferencing + NULL pointer. + 2014-03-21 Pedro Alves * infrun.c (normal_stop): Extend comment. diff --git a/gdb/extension.c b/gdb/extension.c index c2f502b8305..1146cc7d03c 100644 --- a/gdb/extension.c +++ b/gdb/extension.c @@ -342,7 +342,8 @@ eval_ext_lang_from_control_command (struct command_line *cmd) { if (extlang->cli_control_type == cmd->control_type) { - if (extlang->ops->eval_from_control_command != NULL) + if (extlang->ops != NULL + && extlang->ops->eval_from_control_command != NULL) { extlang->ops->eval_from_control_command (extlang, cmd); return; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index aad07fdb54a..f1f06799e9d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-22 Doug Evans + + * gdb.python/python.exp (python not supported): Verify multi-line + python command issues an error. + 2014-03-21 Maciej W. Rozycki * gdb.threads/thread-specific.exp: Handle the lack of usable diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index a470427fd80..5b8d34a0ab2 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -41,6 +41,13 @@ gdb_test_multiple "python print (23)" "verify python support" { gdb_test "source $srcdir/$subdir/source2.py" \ "Error in sourced command file:.*" \ "source source2.py when python disabled" + + # Verify multi-line python commands cause an error. + gdb_py_test_multiple "multi-line python command" \ + "python" "" \ + "print (23)" "" \ + "end" "not supported.*" + return -1 } -re "$gdb_prompt $" {}