From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32215 invoked by alias); 20 Oct 2010 13:08:30 -0000 Received: (qmail 31965 invoked by uid 22791); 20 Oct 2010 13:08:28 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-wy0-f169.google.com (HELO mail-wy0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Oct 2010 13:08:23 +0000 Received: by wyf28 with SMTP id 28so3923017wyf.0 for ; Wed, 20 Oct 2010 06:08:20 -0700 (PDT) Received: by 10.216.47.140 with SMTP id t12mr7539636web.102.1287580100316; Wed, 20 Oct 2010 06:08:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.179.14 with HTTP; Wed, 20 Oct 2010 06:08:00 -0700 (PDT) In-Reply-To: References: From: Hui Zhu Date: Wed, 20 Oct 2010 13:08:00 -0000 Message-ID: Subject: Re: About the initialization of 'struct linux_record_tdep' To: xingxing pan Cc: gdb , "Joseph S. Myers" Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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 X-SW-Source: 2010-10/txt/msg00073.txt.bz2 On Fri, Oct 15, 2010 at 00:40, Joseph S. Myers wrote: > On Thu, 14 Oct 2010, xingxing pan wrote: > >> Hi. I'm just porting the process record function to an ARM similar arch. >> To initialize the struct linux_record_tdep, one has to collect the >> size of various types. >> Is there some way to do this beside diving into the kernel source or >> system including files? >> Why not finish the collecting during the configure stage? > > You don't generally have target headers available when configuring GDB, > only those for the host system, and it is also possible that a single GDB > configuration supports multiple target ABIs (32-bit and 64-bit say). > > -- > Joseph S. Myers > joseph@codesourcery.com > I agree with that, for current status, this config didn't need anything of target linux kernel. Following part is a file that get the size of some kernel struct, you can use it to get this size. Thanks, Hui #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #include //#include #include #include #define __USE_LARGEFILE64 #include #include #include #include struct a__old_kernel_stat { unsigned short st_dev; unsigned short st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; unsigned int st_size; unsigned int a; unsigned int b; unsigned int c; }; int main(int argc,char *argv[],char *envp[]) { printf ("%d\n", sizeof (char *)); printf ("%d\n", sizeof (struct a__old_kernel_stat)); printf ("%d\n", sizeof (struct tms)); printf ("%d\n", sizeof (loff_t)); printf ("%d\n", sizeof (struct flock)); printf ("%d\n", sizeof (struct oldold_utsname)); printf ("%d\n", sizeof (struct ustat)); printf ("%d\n", sizeof (struct sigaction)); printf ("%d\n", sizeof (sigset_t)); printf ("%d\n", sizeof (struct rlimit)); printf ("%d\n", sizeof (struct rusage)); printf ("%d\n", sizeof (struct timeval)); printf ("%d\n", sizeof (struct timezone)); printf ("%d\n", sizeof (unsigned short)); printf ("%d\n", sizeof (fd_set)); printf ("%d\n", sizeof (struct dirent)); printf ("%d\n", sizeof (struct dirent64)); printf ("%d\n", sizeof (struct statfs)); printf ("%d\n", sizeof (struct statfs64)); printf ("%d\n", sizeof (struct sockaddr)); printf ("%d\n", sizeof (int)); printf ("%d\n", sizeof (long)); printf ("%d\n", sizeof (unsigned long)); printf ("%d\n", sizeof (struct msghdr)); printf ("%d\n", sizeof (struct itimerval)); printf ("%d\n", sizeof (struct stat)); printf ("%d\n", sizeof (struct old_utsname)); printf ("%d\n", sizeof (struct sysinfo)); printf ("%d\n", sizeof (struct msqid_ds)); printf ("%d\n", sizeof (struct shmid_ds)); printf ("%d\n", sizeof (struct new_utsname)); printf ("%d\n", sizeof (struct timex)); printf ("%d\n", sizeof (struct dqinfo)); printf ("%d\n", sizeof (struct dqblk)); printf ("%d\n", sizeof (struct fs_quota_stat)); printf ("%d\n", sizeof (struct timespec)); printf ("%d\n", sizeof (struct pollfd)); printf ("%d\n", sizeof (struct knfsd_fh)); printf ("%d\n", sizeof (struct sigaction)); printf ("%d\n", sizeof (sigset_t)); printf ("%d\n", sizeof (siginfo_t)); printf ("%d\n", sizeof (cap_user_data_t)); printf ("%d\n", sizeof (stack_t)); printf ("%d\n", sizeof (off_t)); printf ("%d\n", sizeof (struct stat64)); printf ("%d\n", sizeof (gid_t)); printf ("%d\n", sizeof (uid_t)); //printf ("%d\n", sizeof (struct flock64)); printf ("%d\n", sizeof (struct user_desc)); printf ("%d\n", sizeof (struct io_event)); printf ("%d\n", sizeof (struct iocb)); printf ("%d\n", sizeof (struct epoll_event)); printf ("%d\n", sizeof (struct itimerspec)); printf ("%d\n", sizeof (struct mq_attr)); printf ("%d\n", sizeof (struct siginfo)); //printf ("%d\n", sizeof (struct termios)); //printf ("%d\n", sizeof (struct termios2)); printf ("%d\n", sizeof (pid_t)); //printf ("%d\n", sizeof (struct winsize)); printf ("%d\n", sizeof (struct serial_struct)); printf ("%d\n", sizeof (struct serial_icounter_struct)); printf ("%d\n", sizeof (struct hayes_esp_config)); printf ("%d\n", sizeof (size_t)); printf ("%d\n", sizeof (struct iovec)); printf ("%x\n", _IOR('T',0x2A, struct termios2)); printf ("%x\n", _IOW('T',0x2B, struct termios2)); printf ("%x\n", _IOR('T',0x2C, struct termios2)); printf ("%x\n", _IOR('T',0x2D, struct termios2)); printf ("%x\n", _IOR('T',0x30, unsigned int)); printf ("%x\n", _IOW('T',0x31, int)); return (0); }