From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31397 invoked by alias); 16 Sep 2015 14:41:34 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 31378 invoked by uid 89); 16 Sep 2015 14:41:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_20,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: eusmtp01.atmel.com Received: from eusmtp01.atmel.com (HELO eusmtp01.atmel.com) (212.144.249.242) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 16 Sep 2015 14:41:29 +0000 Received: from HNOCHT01.corp.atmel.com (10.161.30.161) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server (TLS) id 14.3.235.1; Wed, 16 Sep 2015 16:41:23 +0200 Received: from jaguar.corp.atmel.com (10.161.30.18) by HNOCHT01.corp.atmel.com (10.161.30.161) with Microsoft SMTP Server (TLS) id 14.3.235.1; Wed, 16 Sep 2015 16:41:26 +0200 Date: Wed, 16 Sep 2015 14:41:00 -0000 From: Senthil Kumar Selvaraj To: Subject: sizeof evaluates expression to compute size? Message-ID: <20150916144109.GB14658@jaguar.corp.atmel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00010.txt.bz2 Hi, Is it true that gdb evaluates the expression in a "print sizeof(expression)" to figure out the size? For one expression on the ARM target print sizeof((char*)(s->m) where s is a struct and m is a fixed length char array member)), gdb even tries to allocate memory in the inferior (through an injected malloc call) to compute the size. Am I missing something? Is there a reason why gdb does this? Surely it should be able to compute the type (and hence the size) statically? Regards Senthil