From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97889 invoked by alias); 21 Jan 2019 15:41:17 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 97417 invoked by uid 89); 21 Jan 2019 15:41:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=maximal, Associate, Manager X-HELO: mail-ot1-f45.google.com Received: from mail-ot1-f45.google.com (HELO mail-ot1-f45.google.com) (209.85.210.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Jan 2019 15:41:14 +0000 Received: by mail-ot1-f45.google.com with SMTP id k98so20894762otk.3 for ; Mon, 21 Jan 2019 07:41:14 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: David Smith Date: Mon, 21 Jan 2019 15:41:00 -0000 Message-ID: Subject: Re: Is this a bug from function kernel_int? To: Yue Cao Cc: systemtap Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-q1/txt/msg00008.txt.bz2 On Sun, Jan 20, 2019 at 3:49 AM Yue Cao wrote: > > Hi there, > > Recently I find systemtap generates a wrong result when I use kernel_int to > print out the int value from the pointer. In my case, systemtap prints out > a huge value (18446744072649393666) with kernel_int. As you can see, this > value is larger than 2^32 (the maximal value for int). However, when I use > kernel_long, the result is within 2^32. The new value (3234809346) actually > is equal to what I expected by using kernel_int. I have tried multiple > times and the results are same. I wonder is it a bug. Could anyone tell me > how to fix it? You are confusing an 'int' with a 32-bit value. Depending on the architecture, they aren't the same. Typically on a 64-bit platform, the C language type 'int' is a 64-bit value. Typically on a 32-bit platform, the C language type 'int' is a 32-bit value. If you are sure you want a 32-bit value, you can call the __int32() function on a value. (Although note that the '__' prefix means that is really an internal function by convention.) So, depending on your architecture, kernel_int() returning a 64-bit value could be a bug or could be the expected behavior. -- David Smith Associate Manager Red Hat