From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28978 invoked by alias); 26 Sep 2014 13:29:49 -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 28966 invoked by uid 89); 26 Sep 2014 13:29:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 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-f179.google.com Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 26 Sep 2014 13:29:47 +0000 Received: by mail-wi0-f179.google.com with SMTP id d1so11554867wiv.6 for ; Fri, 26 Sep 2014 06:29:44 -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=SA6G2IbPdgCVDnM2drbYseSbZt1KqX9dZ2yo7PKtgek=; b=AeBFf6s1V/kPpet4PSYjm/ScnathTKFBTdXA5iJsWbxkki8kjRaYp6XS1Gruo7YVPY KCnQzoFsxl9f8VH3dk56+AUdMxm9c/nPpwVjO2wzzUvts+UTDJM1EqOnrh1n+IPjLM2U d6N/KLtBt/8xShQrcj2jIzNR/iF5q53h1kqE6kz3zH64gNkbs0cqx24JI5jACcELaoFK FRA8iOgvwsGRTSRP/Lbnkc97jH2nKqaxjjt7fCJKdVM5hcqwG+BGtt+BKOOeIbhvH9SY wRSRJRHZ1XZrU1vTy1p7Nulr9t1T+Jrw7lI1Eu0V/Y1OviY0deY+vXPxVdVec+88Bj7k ZlHg== X-Gm-Message-State: ALoCoQklRwvZt4eVvo+aBSbT1VMRWQ9PWM5IBsoFR404JxbjiCWYv5QINl5kospX7o27DIJg2X7g MIME-Version: 1.0 X-Received: by 10.194.78.101 with SMTP id a5mr3530020wjx.118.1411738184015; Fri, 26 Sep 2014 06:29:44 -0700 (PDT) Received: by 10.27.53.136 with HTTP; Fri, 26 Sep 2014 06:29:43 -0700 (PDT) Date: Fri, 26 Sep 2014 13:29:00 -0000 Message-ID: Subject: [PATCH 0/2] Make chained function calls in expressions work From: Siva Chandra To: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00788.txt.bz2 This patch series enables having chained function calls in expressions. An example of a chained function call is shown in PR c++/11606. It has an example of a chain of two function calls. This patch series enables chains of any number of function calls. Currently, an inferior function call is handled via call_function_by_hand. The value returned by the inferior function is copied into a GDB value whose lval_type is not_lval. Its contents are stored within the value irrespective of whether the return value is in inferior memory or in a register. Consequently, any subsequent function call in the expression which requires this value's address as an argument throws an error as the value is not in inferior memory. This patch series keeps most of the current flow intact, except that the value returned by the inferior function is made to be a new lval_type called lval_mirrored_on_inferior_stack. These values have a mirrored value of lval_type lval_memory which reside on the inferior stack. They reside on the stack only for the duration for which the expression is evaluated. This enables value_address to return the address of the stack mirror instead of throwing an error. Patch 1/2 - Adds new lval_type named lval_mirrored_on_inferior_stack. Also adds support for values with this lval_type. Patch 2/2 - Enables chained function calls by mirroring values returned by inferior functions in the inferior stack. Patch 2/2 only targets values returned by call_function_by_hand. I think similar things can done for call_internal_function and call_xmethod. I will extend the idea to these functions as well after this patch series is approved (if at all). Thanks, Siva Chandra