From patchwork Tue Apr 29 13:49:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siva Chandra Reddy X-Patchwork-Id: 746 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id A8EEB360078 for ; Tue, 29 Apr 2014 06:49:34 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id 5848F148743E; Tue, 29 Apr 2014 06:49:33 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 124A3135FF16 for ; Tue, 29 Apr 2014 06:49:33 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=c7l694eYedpm7KsTvE+uW6boyJNHm +uKKN4nJI4aAWcmOEV5ivXm/TNdBuxmVlTSX/VXmxRvbTnuHEQOxQ1E2ZTUcENZr 4cJSZ3Z2vrLHYGKTYuhsWe6hJrLSSrTrMl2OxMEz/KJZwZ5gh3BjV6RugS1WXvoU 8DxCk/XlsQXPk4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=3QFduWdGLmX6KymxnA4gjkoLsDw=; b=Gms ecMwZ9IQ0Uugc/FFTHMZ2JCCyV082I1BnDqukQgV5dONEIZTjYTmDqOJqY+pWqkZ XE9SnODCgqOIJGo85EzXcTL8N8S2p7owlwtS7yL9ZZTdKV6XiAfDoOKE9hT5tREI 3HoLJGcXucn73Jt0NxXceJifkIncU1GmxB6OWdss= Received: (qmail 28227 invoked by alias); 29 Apr 2014 13:49:29 -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 28150 invoked by uid 89); 29 Apr 2014 13:49:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f175.google.com Received: from mail-wi0-f175.google.com (HELO mail-wi0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 29 Apr 2014 13:49:27 +0000 Received: by mail-wi0-f175.google.com with SMTP id cc10so7433983wib.14 for ; Tue, 29 Apr 2014 06:49:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=p/C2zCZQNNrDJAmN7U2ZyO3+vvbZyQuPSj7sBPvsEUY=; b=KiOHtbXmETbHo8pibJKFFkynNwhNbcnyjEG1ks7g47vftVA5QOPIw4tMRCyYNAoVXr xnnnU6TgKllJG3d8Doj4hgqVrl6zFtcNdmWIA3rHd95ZkYXZ93e/3xv8uaA/+S9MAcbj NbQEjPyWqd68V+82ggDKMw+H+EV24XfqzzlgW/r++hSVBFX5DMuQs47z019jbpPkw8pJ b/Zbp3YOgbGwCEjnFnQOy1qvqDvUO5+rjwr8iknzcKcHWiuSL+2ImFu9RwTUxlThY0Yp NmMXpV574c8z7Vcx4PK42V9y5O8DWR/3Ixt//GKVVI+iblynIW6cAtHKsub27nhyqboo 7alA== X-Gm-Message-State: ALoCoQmq5QUoQfKpKmBPg1uLUiY4QzZA2M8HIXmVzP0B9EGY2cxABNxC+Hg8XAPaVN1Pfv2VM0feQLRukfEgSCwHriI+jSktAMFppDzrlUzHP64UD4vyb/R9YM/O4FDpx2x8fyRCMuldh3ZU+OxEemPvE5t1B2Y7lScIkprfcLF435cT2FtAjkLBKVVCBTdpuxFr0JNuKF8DJnsoi5CnvoGeKHndrQX3qA== MIME-Version: 1.0 X-Received: by 10.194.187.50 with SMTP id fp18mr554333wjc.89.1398779362972; Tue, 29 Apr 2014 06:49:22 -0700 (PDT) Received: by 10.217.51.7 with HTTP; Tue, 29 Apr 2014 06:49:22 -0700 (PDT) Date: Tue, 29 Apr 2014 06:49:22 -0700 Message-ID: Subject: [PATCH] Remove unused arguments to few functions in dwarf2loc.c and gdbtypes.c. From: Siva Chandra To: gdb-patches X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in The attached patch removes unused arguments to few recently added (few as recent as yesterday) functions. I did not see any reasoning as to why they exist in the patch posts to gdb-patches. I did some digging as to why the unused args could be useful at all. For example, one function touched by the attached patch is dwarf2loc:dwarf2_evaluate_property. Before this patch, this function required an (eventually) unused argument of type CORE_ADDR. I think the intention there was correct: A dynamic property is probably embedded in the value and hence the value address is required to evaluate it. However, the patch that added this function added c99 vla support. I think the array lengths for VLAs are not embedded in the (array) object but somewhere else (the stack frame for example). Hence, the value address is not required. Am I missing something here? [One property for which the value address could be useful is when evaluating bitpos of virtual base class fields. However, in the Python API for example, one looks up bitpos via gdb.Field.bitpos where the field object is typically got via gdb.Type.fields() and not via a gdb.Value object. Hence, dwarf2loc:dwarf2_evaluate_property is not really useful with or without the CORE_ADDR argument for this. I am working on a patch which looks up the bitpos of virtual base classes dynamically via the vtable of the class.] gdb/ChangeLog: 2014-04-29 Siva Chandra Reddy * dwarf2loc.c (dwarf2_locexpr_baton_eval, dwarf2_evaluate_property): Remove unused CORE_ADDR argument. Update all callers. * dwarf2loc.h (dwarf2_evaluate_property): Update signature. * gdbtypes.c (resolve_dynamic_range, resolve_dynamic_array): Remove unused CORE_ADDR argument. Update all callers. diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index fa17ea6..5517442 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -2436,7 +2436,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, static int dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, - CORE_ADDR addr, CORE_ADDR *valp) + CORE_ADDR *valp) { struct dwarf_expr_context *ctx; struct dwarf_expr_baton baton; @@ -2491,8 +2491,7 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, /* See dwarf2loc.h. */ int -dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR address, - CORE_ADDR *value) +dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value) { if (prop == NULL) return 0; @@ -2503,7 +2502,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR address, { const struct dwarf2_property_baton *baton = prop->data.baton; - if (dwarf2_locexpr_baton_eval (&baton->locexpr, address, value)) + if (dwarf2_locexpr_baton_eval (&baton->locexpr, value)) { if (baton->referenced_type) { diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h index 36173c5..8ad5fa9 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h @@ -96,7 +96,7 @@ struct value *dwarf2_evaluate_loc_desc (struct type *type, into VALUE, otherwise returns 0. */ int dwarf2_evaluate_property (const struct dynamic_prop *prop, - CORE_ADDR addr, CORE_ADDR *value); + CORE_ADDR *value); CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu, unsigned int addr_index); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 1a07420..8e6631a 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1646,7 +1646,7 @@ is_dynamic_type (struct type *type) } static struct type * -resolve_dynamic_range (struct type *dyn_range_type, CORE_ADDR addr) +resolve_dynamic_range (struct type *dyn_range_type) { CORE_ADDR value; struct type *static_range_type; @@ -1657,7 +1657,7 @@ resolve_dynamic_range (struct type *dyn_range_type, CORE_ADDR addr) gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE); prop = &TYPE_RANGE_DATA (dyn_range_type)->low; - if (dwarf2_evaluate_property (prop, addr, &value)) + if (dwarf2_evaluate_property (prop, &value)) { low_bound.kind = PROP_CONST; low_bound.data.const_val = value; @@ -1669,7 +1669,7 @@ resolve_dynamic_range (struct type *dyn_range_type, CORE_ADDR addr) } prop = &TYPE_RANGE_DATA (dyn_range_type)->high; - if (dwarf2_evaluate_property (prop, addr, &value)) + if (dwarf2_evaluate_property (prop, &value)) { high_bound.kind = PROP_CONST; high_bound.data.const_val = value; @@ -1696,7 +1696,7 @@ resolve_dynamic_range (struct type *dyn_range_type, CORE_ADDR addr) of the associated array. */ static struct type * -resolve_dynamic_array (struct type *type, CORE_ADDR addr) +resolve_dynamic_array (struct type *type) { CORE_ADDR value; struct type *elt_type; @@ -1707,12 +1707,12 @@ resolve_dynamic_array (struct type *type, CORE_ADDR addr) elt_type = type; range_type = check_typedef (TYPE_INDEX_TYPE (elt_type)); - range_type = resolve_dynamic_range (range_type, addr); + range_type = resolve_dynamic_range (range_type); ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type)); if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY) - elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type), addr); + elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type)); else elt_type = TYPE_TARGET_TYPE (type); @@ -1751,11 +1751,11 @@ resolve_dynamic_type (struct type *type, CORE_ADDR addr) } case TYPE_CODE_ARRAY: - resolved_type = resolve_dynamic_array (type, addr); + resolved_type = resolve_dynamic_array (type); break; case TYPE_CODE_RANGE: - resolved_type = resolve_dynamic_range (type, addr); + resolved_type = resolve_dynamic_range (type); break; }