From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15480 invoked by alias); 25 Mar 2009 19:00:28 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 15440 invoked by uid 9674); 25 Mar 2009 19:00:27 -0000 Date: Wed, 25 Mar 2009 19:00:00 -0000 Message-ID: <20090325190027.15423.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-python: Merge commit 'origin/archer-tromey-python' into archer-jankratochvil-python X-Git-Refname: refs/heads/archer-jankratochvil-python X-Git-Reftype: branch X-Git-Oldrev: 57ef0cba8a93024e781a32a323884f8a7ff1d557 X-Git-Newrev: 2e4985cad1fc3d054eaceac9aef5fed7dfa2fd37 X-SW-Source: 2009-q1/txt/msg00371.txt.bz2 List-Id: The branch, archer-jankratochvil-python has been updated via 2e4985cad1fc3d054eaceac9aef5fed7dfa2fd37 (commit) via ffcb73fcb226abe0bb6d6f6855f479f0c5456527 (commit) from 57ef0cba8a93024e781a32a323884f8a7ff1d557 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: gdb/stack.c | 53 ++++++++--------------------------------------------- gdb/valprint.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 45 deletions(-) First 500 lines of diff: diff --git a/gdb/stack.c b/gdb/stack.c index d6ef5a3..88b672d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -58,7 +58,7 @@ void (*deprecated_selected_frame_level_changed_hook) (int); static const char *print_frame_arguments_choices[] = {"all", "scalars", "none", NULL}; -static const char *print_frame_arguments = "all"; +static const char *print_frame_arguments = "scalars"; /* Prototypes for local functions. */ @@ -158,46 +158,6 @@ print_frame_nameless_args (struct frame_info *frame, long start, int num, } } -/* Return non-zero if the debugger should print the value of the provided - symbol parameter (SYM). */ - -static int -print_this_frame_argument_p (struct symbol *sym) -{ - struct type *type; - - /* If the user asked to print no argument at all, then obviously - do not print this argument. */ - - if (strcmp (print_frame_arguments, "none") == 0) - return 0; - - /* If the user asked to print all arguments, then we should print - that one. */ - - if (strcmp (print_frame_arguments, "all") == 0) - return 1; - - /* The user asked to print only the scalar arguments, so do not - print the non-scalar ones. */ - - type = CHECK_TYPEDEF (SYMBOL_TYPE (sym)); - while (TYPE_CODE (type) == TYPE_CODE_REF) - type = CHECK_TYPEDEF (TYPE_TARGET_TYPE (type)); - switch (TYPE_CODE (type)) - { - case TYPE_CODE_ARRAY: - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - case TYPE_CODE_SET: - case TYPE_CODE_STRING: - case TYPE_CODE_BITSTRING: - return 0; - default: - return 1; - } -} - /* Print the arguments of frame FRAME on STREAM, given the function FUNC running in that frame (as a symbol), where NUM is the number of arguments according to the stack frame (or -1 if the number of @@ -220,6 +180,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame, int args_printed = 0; struct cleanup *old_chain, *list_chain; struct ui_stream *stb; + /* True if we should print arguments, false otherwise. */ + int print_args = strcmp (print_frame_arguments, "none"); + /* True in "summary" mode, false otherwise. */ + int summary = !strcmp (print_frame_arguments, "scalars"); stb = ui_out_stream_new (uiout); old_chain = make_cleanup_ui_out_stream_delete (stb); @@ -354,7 +318,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame, annotate_arg_name_end (); ui_out_text (uiout, "="); - if (print_this_frame_argument_p (sym)) + if (print_args) { /* Avoid value_print because it will deref ref parameters. We just want to print their addresses. Print ??? for @@ -381,9 +345,8 @@ print_frame_args (struct symbol *func, struct frame_info *frame, get_raw_print_options (&opts); opts.deref_ref = 0; - opts.summary = 1; - common_val_print (val, stb->stream, 2, - &opts, language); + opts.summary = summary; + common_val_print (val, stb->stream, 2, &opts, language); ui_out_field_stream (uiout, "value", stb); } else diff --git a/gdb/valprint.c b/gdb/valprint.c index 1eb7088..4f2ddbe 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -217,6 +217,33 @@ show_addressprint (struct ui_file *file, int from_tty, } +/* A helper function for val_print. When printing in "summary" mode, + we want to print scalar arguments, but not aggregate arguments. + This function distinguishes between the two. */ + +static int +scalar_type_p (struct type *type) +{ + CHECK_TYPEDEF (type); + while (TYPE_CODE (type) == TYPE_CODE_REF) + { + type = TYPE_TARGET_TYPE (type); + CHECK_TYPEDEF (type); + } + switch (TYPE_CODE (type)) + { + case TYPE_CODE_ARRAY: + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + case TYPE_CODE_SET: + case TYPE_CODE_STRING: + case TYPE_CODE_BITSTRING: + return 0; + default: + return 1; + } +} + /* Print using the given LANGUAGE the data of type TYPE located at VALADDR (within GDB), which came from the inferior at address ADDRESS, onto stdio stream STREAM according to OPTIONS. @@ -269,6 +296,14 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, return ret; } + /* Handle summary mode. If the value is a scalar, print it; + otherwise, print an ellipsis. */ + if (options->summary && !scalar_type_p (type)) + { + fprintf_filtered (stream, "..."); + return 0; + } + TRY_CATCH (except, RETURN_MASK_ERROR) { ret = language->la_val_print (type, valaddr, embedded_offset, address, hooks/post-receive -- Repository for Project Archer.