From patchwork Mon Nov 24 04:35:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 3876 Received: (qmail 3736 invoked by alias); 24 Nov 2014 04:36:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3723 invoked by uid 89); 24 Nov 2014 04:36:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f171.google.com Received: from mail-pd0-f171.google.com (HELO mail-pd0-f171.google.com) (209.85.192.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 24 Nov 2014 04:36:32 +0000 Received: by mail-pd0-f171.google.com with SMTP id y13so982879pdi.30 for ; Sun, 23 Nov 2014 20:36:31 -0800 (PST) X-Received: by 10.66.65.165 with SMTP id y5mr29585248pas.70.1416803791151; Sun, 23 Nov 2014 20:36:31 -0800 (PST) Received: from seba.sebabeach.org.gmail.com (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id dh12sm11130166pac.17.2014.11.23.20.36.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Nov 2014 20:36:30 -0800 (PST) From: Doug Evans To: gdb-patches@sourceware.org Subject: [COMMITTED PATCH] Fix dumping of function arguments. Date: Sun, 23 Nov 2014 20:35:39 -0800 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. I noticed that the output for function arguments in "mt print type foo" was not properly aligned, and hard to read (e.g., not numbered). Function arguments also don't have names but that's because gdb ignores argument names when reading the dwarf. That's a separate bug, and there's no reason not to print the name: it's helpful to the reader to at least know it is NULL. 2014-11-23 Doug Evans * gdbtypes.c (print_args): Renamed from print_arg_types. Print arg number and name if present. All callers updated. (dump_fn_fieldlists): Fix indentation of args. diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index b921c64..976d56f 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3509,14 +3509,18 @@ print_bit_vector (B_TYPE *bits, int nbits) situation. */ static void -print_arg_types (struct field *args, int nargs, int spaces) +print_args (struct field *args, int nargs, int spaces) { if (args != NULL) { int i; for (i = 0; i < nargs; i++) - recursive_dump_type (args[i].type, spaces + 2); + { + printfi_filtered (spaces, "[%d] name '%s'\n", i, + args[i].name != NULL ? args[i].name : ""); + recursive_dump_type (args[i].type, spaces + 2); + } } } @@ -3574,11 +3578,9 @@ dump_fn_fieldlists (struct type *type, int spaces) gdb_print_host_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout); printf_filtered ("\n"); - - print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), - TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, - overload_idx)), - spaces); + print_args (TYPE_FN_FIELD_ARGS (f, overload_idx), + TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, overload_idx)), + spaces + 8 + 2); printfi_filtered (spaces + 8, "fcontext "); gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx), gdb_stdout);