From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14200 invoked by alias); 24 Jun 2010 08:55:41 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 14140 invoked by uid 9674); 24 Jun 2010 08:55:40 -0000 Date: Thu, 24 Jun 2010 08:55:00 -0000 Message-ID: <20100624085540.14125.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] master: Merge remote branch 'gdb/master' X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: fdb12557105f3e7f0de726ecdf55b88aef413776 X-Git-Newrev: e631bbacdd0e7d2fc9f46e70b0613f5d3fdc6a9e X-SW-Source: 2010-q2/txt/msg00104.txt.bz2 List-Id: The branch, master has been updated via e631bbacdd0e7d2fc9f46e70b0613f5d3fdc6a9e (commit) via f16eecf420d7d1e00b1508f42fbccfd8046a1778 (commit) via b2848d06b861b8a14a87e59a0b63b8b2b17cdc2b (commit) via 530b66b99ed6e938e43087001b88f37f632ad758 (commit) from fdb12557105f3e7f0de726ecdf55b88aef413776 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit e631bbacdd0e7d2fc9f46e70b0613f5d3fdc6a9e Merge: fdb12557105f3e7f0de726ecdf55b88aef413776 f16eecf420d7d1e00b1508f42fbccfd8046a1778 Author: Jan Kratochvil Date: Thu Jun 24 10:55:33 2010 +0200 Merge remote branch 'gdb/master' commit f16eecf420d7d1e00b1508f42fbccfd8046a1778 Author: Hui Zhu Date: Thu Jun 24 06:12:11 2010 +0000 Add command "eval". commit b2848d06b861b8a14a87e59a0b63b8b2b17cdc2b Author: gdbadmin Date: Thu Jun 24 00:00:09 2010 +0000 *** empty log message *** commit 530b66b99ed6e938e43087001b88f37f632ad758 Author: Alan Modra Date: Thu Jun 24 00:00:08 2010 +0000 daily update ----------------------------------------------------------------------- Summary of changes: bfd/version.h | 2 +- gdb/ChangeLog | 6 ++++ gdb/NEWS | 4 ++ gdb/doc/ChangeLog | 5 +++ gdb/doc/gdb.texinfo | 5 +++ gdb/printcmd.c | 64 ++++++++++++++++++++++++++++++-------- gdb/testsuite/ChangeLog | 4 ++ gdb/testsuite/gdb.base/eval.exp | 22 +++++++++++++ gdb/version.in | 2 +- 9 files changed, 98 insertions(+), 16 deletions(-) create mode 100644 gdb/testsuite/gdb.base/eval.exp First 500 lines of diff: diff --git a/bfd/version.h b/bfd/version.h index c000efa..00d837d 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20100623 +#define BFD_VERSION_DATE 20100624 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b6dd364..b87110d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2010-06-24 Hui Zhu + + * printcmd.c (ui_printf): New function. + (printf_command): Call ui_printf. + (_initialize_printcmd): New command "eval". + 2010-06-23 Ulrich Weigand * infrun.c (handle_inferior_event): Handle presence of single-step diff --git a/gdb/NEWS b/gdb/NEWS index af65274..1e1ea39 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -84,6 +84,10 @@ qRelocInsn * New commands +eval template, expressions... + Convert the values of one or more expressions under the control + of the string template to a command line, and call it. + set target-file-system-kind unix|dos-based|auto show target-file-system-kind Set or show the assumed file system kind for target reported file diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 5b59f20..90d767a 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2010-06-24 Hui Zhu + + * gdb.texinfo: (Commands for Controlled Output): Add + documentation for command "eval". + 2010-06-21 Stan Shebs * gdb.texinfo: Add explicit @node and @appendix for GFDL. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 463030f..cbd636f 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -20073,6 +20073,11 @@ Here's an example of printing DFP types using the above conversion letters: printf "D32: %Hf - D64: %Df - D128: %DDf\n",1.2345df,1.2E10dd,1.2E1dl @end smallexample +@kindex eval +@item eval @var{template}, @var{expressions}@dots{} +Convert the values of one or more @var{expressions} under the control of +the string @var{template} to a command line, and call it. + @end table @node Python diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 42aff63..430ccee 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1956,8 +1956,10 @@ print_variable_and_value (const char *name, struct symbol *var, fprintf_filtered (stream, "\n"); } +/* printf "printf format string" ARG to STREAM. */ + static void -printf_command (char *arg, int from_tty) +ui_printf (char *arg, struct ui_file *stream) { char *f = NULL; char *s = arg; @@ -2340,7 +2342,7 @@ printf_command (char *arg, int from_tty) read_memory (tem, str, j); str[j] = 0; - printf_filtered (current_substring, (char *) str); + fprintf_filtered (stream, current_substring, (char *) str); } break; case wide_string_arg: @@ -2384,7 +2386,8 @@ printf_command (char *arg, int from_tty) &output, translit_char); obstack_grow_str0 (&output, ""); - printf_filtered (current_substring, obstack_base (&output)); + fprintf_filtered (stream, current_substring, + obstack_base (&output)); do_cleanups (inner_cleanup); } break; @@ -2416,7 +2419,8 @@ printf_command (char *arg, int from_tty) &output, translit_char); obstack_grow_str0 (&output, ""); - printf_filtered (current_substring, obstack_base (&output)); + fprintf_filtered (stream, current_substring, + obstack_base (&output)); do_cleanups (inner_cleanup); } break; @@ -2433,7 +2437,7 @@ printf_command (char *arg, int from_tty) if (inv) error (_("Invalid floating value found in program.")); - printf_filtered (current_substring, (double) val); + fprintf_filtered (stream, current_substring, (double) val); break; } case long_double_arg: @@ -2450,7 +2454,8 @@ printf_command (char *arg, int from_tty) if (inv) error (_("Invalid floating value found in program.")); - printf_filtered (current_substring, (long double) val); + fprintf_filtered (stream, current_substring, + (long double) val); break; } #else @@ -2461,7 +2466,7 @@ printf_command (char *arg, int from_tty) { long long val = value_as_long (val_args[i]); - printf_filtered (current_substring, val); + fprintf_filtered (stream, current_substring, val); break; } #else @@ -2471,14 +2476,14 @@ printf_command (char *arg, int from_tty) { int val = value_as_long (val_args[i]); - printf_filtered (current_substring, val); + fprintf_filtered (stream, current_substring, val); break; } case long_arg: { long val = value_as_long (val_args[i]); - printf_filtered (current_substring, val); + fprintf_filtered (stream, current_substring, val); break; } @@ -2490,7 +2495,7 @@ printf_command (char *arg, int from_tty) #if defined (PRINTF_HAS_DECFLOAT) /* If we have native support for Decimal floating printing, handle it here. */ - printf_filtered (current_substring, param_ptr); + fprintf_filtered (stream, current_substring, param_ptr); #else /* As a workaround until vasprintf has native support for DFP @@ -2579,7 +2584,7 @@ printf_command (char *arg, int from_tty) decimal_to_string (dfp_ptr, dfp_len, byte_order, decstr); /* Print the DFP value. */ - printf_filtered (current_substring, decstr); + fprintf_filtered (stream, current_substring, decstr); break; #endif @@ -2634,13 +2639,13 @@ printf_command (char *arg, int from_tty) *fmt_p++ = 'l'; *fmt_p++ = 'x'; *fmt_p++ = '\0'; - printf_filtered (fmt, val); + fprintf_filtered (stream, fmt, val); } else { *fmt_p++ = 's'; *fmt_p++ = '\0'; - printf_filtered (fmt, "(nil)"); + fprintf_filtered (stream, fmt, "(nil)"); } break; @@ -2658,11 +2663,38 @@ printf_command (char *arg, int from_tty) puts_filtered here. Also, we pass a dummy argument because some platforms have modified GCC to include -Wformat-security by default, which will warn here if there is no argument. */ - printf_filtered (last_arg, 0); + fprintf_filtered (stream, last_arg, 0); } do_cleanups (old_cleanups); } +/* Implement the "printf" command. */ + +static void +printf_command (char *arg, int from_tty) +{ + ui_printf (arg, gdb_stdout); +} + +/* Implement the "eval" command. */ + +static void +eval_command (char *arg, int from_tty) +{ + struct ui_file *ui_out = mem_fileopen (); + struct cleanup *cleanups = make_cleanup_ui_file_delete (ui_out); + char *expanded; + + ui_printf (arg, ui_out); + + expanded = ui_file_xstrdup (ui_out, NULL); + make_cleanup (xfree, expanded); + + execute_command (expanded, from_tty); + + do_cleanups (cleanups); +} + void _initialize_printcmd (void) { @@ -2826,4 +2858,8 @@ Show printing of source filename and line number with ."), NULL, NULL, show_print_symbol_filename, &setprintlist, &showprintlist); + + add_com ("eval", no_class, eval_command, _("\ +Convert \"printf format string\", arg1, arg2, arg3, ..., argn to\n\ +a command line, and call it.")); } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2d82d69..3808ba5 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-06-24 Hui Zhu + + * gdb.base/eval.exp: New file. + 2010-06-23 Ulrich Weigand * gdb.cell/fork.exp: New file. diff --git a/gdb/testsuite/gdb.base/eval.exp b/gdb/testsuite/gdb.base/eval.exp new file mode 100644 index 0000000..9f335dd --- /dev/null +++ b/gdb/testsuite/gdb.base/eval.exp @@ -0,0 +1,22 @@ +# Copyright 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +gdb_exit +gdb_start + +gdb_test_no_output "set \$a = 10" "Initialize \$a." + +gdb_test "eval \"echo %d\\n\", \$a++" "10" "First eval." +gdb_test "eval \"echo %d\\n\", \$a*2" "22" "Second eval." diff --git a/gdb/version.in b/gdb/version.in index 736f33b..b0d8a54 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -7.1.50.20100623-cvs +7.1.50.20100624-cvs hooks/post-receive -- Repository for Project Archer.