Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: xingxing pan <forandom@gmail.com>
Cc: gdb <gdb@sourceware.org>, "Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: About the initialization of 'struct linux_record_tdep'
Date: Wed, 20 Oct 2010 13:08:00 -0000	[thread overview]
Message-ID: <AANLkTimXNz9CKuZYW9LJZnDS1Z9Tcdvy2nZ9ukH+wJTy@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1010141639130.2442@digraph.polyomino.org.uk>

On Fri, Oct 15, 2010 at 00:40, Joseph S. Myers <joseph@codesourcery.com> 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 <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdint.h>
#include <sys/times.h>
#include <linux/utsname.h>
#include <ustat.h>
#include <signal.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/sysinfo.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/shm.h>
#include <sys/timex.h>
#include <sys/quota.h>
#include <linux/dqblk_v1.h>
#include <linux/dqblk_v2.h>
#include <linux/dqblk_xfs.h>
#include <time.h>
#include <poll.h>
#include <linux/nfsd/nfsfh.h>
#include <sys/capability.h>
#include <asm/ldt.h>
#include <linux/aio_abi.h>
#include <sys/epoll.h>
#include <mqueue.h>
//#include <termios.h>
#include <asm/termios.h>
//#include <asm/termbits.h>
#include <linux/serial.h>
#include <linux/hayesesp.h>
#define __USE_LARGEFILE64
#include <dirent.h>
#include <sys/vfs.h>
#include <sys/stat.h>
#include <fcntl.h>



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);
}


      reply	other threads:[~2010-10-20 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-14  1:46 xingxing pan
2010-10-14  3:11 ` Hui Zhu
2010-10-14 16:40 ` Joseph S. Myers
2010-10-20 13:08   ` Hui Zhu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimXNz9CKuZYW9LJZnDS1Z9Tcdvy2nZ9ukH+wJTy@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=forandom@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox