From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16039 invoked by alias); 5 Feb 2004 18:00:50 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 16024 invoked from network); 5 Feb 2004 18:00:49 -0000 Received: from unknown (HELO web13509.mail.yahoo.com) (216.136.173.13) by sources.redhat.com with SMTP; 5 Feb 2004 18:00:49 -0000 Message-ID: <20040205180043.68640.qmail@web13509.mail.yahoo.com> Received: from [128.183.161.142] by web13509.mail.yahoo.com via HTTP; Thu, 05 Feb 2004 10:00:42 PST Date: Thu, 05 Feb 2004 18:00:00 -0000 From: J K Subject: gdb print /x always big endian order? To: gdb@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-02/txt/msg00045.txt.bz2 Hello, I've used a simple code to examine the storage of a short on a big and little endian machine. It seems in GNU gdb Red Hat Linux (5.1-1) when I do a print /x the order is Big Endian regardless of the host architecture. Just wondering if this is expected, I didn't see anything in the docs. short short_val = 31415; unsigned char buff[8]; memcpy(buff,&short_val,2); printf("Short bytes 0x%x 0x%x\n",buff[0],buff[1]); on Little Endian machine: Short bytes 0xb7 0x7a on Big Endian machine: Short bytes 0x7a 0xb7 On the Little Endian machine in gdb: (gdb) p short_val $18 = 31415 (gdb) p /x short_val $19 = 0x7ab7 <- not what I expected. (gdb) x/2xb &short_val 0xbffff82a: 0xb7 0x7a (gdb) x/2ub &short_val 0xbffff82a: 183 122 Memory is in the order I would expect but the print /x shows the order as Big Endian. Thanks, J.K. __________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html