From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22747 invoked by alias); 25 Aug 2013 03:43:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 22728 invoked by uid 89); 25 Aug 2013 03:43:21 -0000 X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,KAM_STOCKGEN,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=no version=3.3.2 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 25 Aug 2013 03:43:20 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1VDRES-0004GI-M3 from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Sat, 24 Aug 2013 20:43:16 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sat, 24 Aug 2013 20:43:15 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Sat, 24 Aug 2013 20:43:15 -0700 From: Yao Qi To: Subject: [PATCH 0/2 v2] Add options to skip unavailable locals Date: Sun, 25 Aug 2013 03:43:00 -0000 Message-ID: <1377402123-3740-1-git-send-email-yao@codesourcery.com> In-Reply-To: <51FA557F.5@redhat.com> References: <51FA557F.5@redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-08/txt/msg00722.txt.bz2 Hi, In the review to '[PATCH 2/2] Add options to skip unavailable locals', Pedro pointed out two things here On 08/01/2013 08:33 PM, Pedro Alves wrote:>> @@ -295,18 +293,39 @@ mi_cmd_stack_list_args (char *command, char **argv, int argc) >> > struct ui_out *uiout = current_uiout; >> > int raw_arg = 0; >> > enum py_bt_status result = PY_BT_ERROR; >> >+ int skip_unavailable = 0; >> >+ int oind = 0; >> > >> >- if (argc > 0) >> >- raw_arg = parse_no_frames_option (argv[0]); >> >+ /* We can't use mi_getopt here, because the number of options is not >> >+ determined. */ > Hmm. Isn't that easy to fix though? We'd just need an mi_getopt > variant that doesn't error out when it sees an unknown option, but > instead returns that option's position (similarly to getopt). It's > then the caller's responsibility to parse the rest of the option > string. I add a variant mi_getopt_silent in patch 1/2 and use it here. >> >@@ -597,7 +626,6 @@ list_args_or_locals (enum what_to_list what, enum print_values values, >> > if (print_me) >> > { >> > struct symbol *sym2; >> >- struct frame_arg arg, entryarg; >> > >> > if (SYMBOL_IS_ARGUMENT (sym)) >> > sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), >> >@@ -607,33 +635,56 @@ list_args_or_locals (enum what_to_list what, enum print_values values, >> > sym2 = sym; >> > gdb_assert (sym2 != NULL); >> > >> >- memset (&arg, 0, sizeof (arg)); >> >- arg.sym = sym2; >> >- arg.entry_kind = print_entry_values_no; >> >- memset (&entryarg, 0, sizeof (entryarg)); >> >- entryarg.sym = sym2; >> >- entryarg.entry_kind = print_entry_values_no; >> >- >> >- switch (values) >> >+ /* Need to read the value before being able to determine >> >+ whether its unavailable. */ >> >+ if (values == PRINT_ALL_VALUES >> >+ || values == PRINT_SIMPLE_VALUES >> >+ || skip_unavailable) >> >+ val = read_var_value (sym2, fi); >> >+ >> >+ if (skip_unavailable >> >+ && (value_entirely_unavailable (val) >> >+ /* A scalar object that does not have all bits >> >+ available is also considered unavailable, >> >+ because all bits contribute to its >> >+ representation. */ >> >+ || (val_print_scalar_type_p (value_type (val)) >> >+ && !value_bytes_available (val, >> >+ value_embedded_offset (val), >> >+ TYPE_LENGTH (value_type (val)))))) >> >+ ; >> >+ else > I don't think this has been updated right for entry values. With > entry values, we now have_two_ values to account for. I think > we need to do this once for each of the regular arg and the > entry arg? > Patch 2/2 is updated to handle entry values by adding a parameter 'skip_unavailable' in function list_arg_or_local. Other comments on changelog and doc are addressed too. Regression tested on x86_64-linux both native and gdbserver. *** BLURB HERE *** Yao Qi (2): Use mi_getopt_silent Add options to skip unavailable locals gdb/NEWS | 4 + gdb/doc/gdb.texinfo | 17 +++- gdb/mi/mi-cmd-stack.c | 127 +++++++++++++++------- gdb/mi/mi-getopt.c | 35 +++++- gdb/mi/mi-getopt.h | 8 +- gdb/testsuite/gdb.trace/entry-values.exp | 5 + gdb/testsuite/gdb.trace/mi-trace-unavailable.exp | 9 ++ gdb/valprint.c | 8 +- gdb/valprint.h | 2 + gdb/value.c | 20 ++++ gdb/value.h | 4 + 11 files changed, 185 insertions(+), 54 deletions(-) -- 1.7.7.6