As usual load elf file
$gdb vmlinux
We are going to inspect the address layout of structure platform_device,
struct platform_device {
const char *name;
int id;
bool id_auto;
struct device dev;
u32 num_resources;
struct resource *resource;
const struct platform_device_id *id_entry;
char *driver_override; /* Driver name to force a match */
/* MFD cell pointer */
struct mfd_cell *mfd_cell;
/* arch specific additions */
struct pdev_archdata archdata;
};
(gdb) p &((struct platform_device *)0)->name
$2 = (const char **) 0x0
(gdb) p &((struct platform_device *)0)->id
$3 = (int *) 0x8
(gdb) p &((struct platform_device *)0)->id_auto
$4 = (bool *) 0xc
(gdb) p &((struct platform_device *)0)->dev
$5 = (struct device *) 0x10
Above output shows the offset of different variables in the structure.
$gdb vmlinux
We are going to inspect the address layout of structure platform_device,
struct platform_device {
const char *name;
int id;
bool id_auto;
struct device dev;
u32 num_resources;
struct resource *resource;
const struct platform_device_id *id_entry;
char *driver_override; /* Driver name to force a match */
/* MFD cell pointer */
struct mfd_cell *mfd_cell;
/* arch specific additions */
struct pdev_archdata archdata;
};
(gdb) p &((struct platform_device *)0)->name
$2 = (const char **) 0x0
(gdb) p &((struct platform_device *)0)->id
$3 = (int *) 0x8
(gdb) p &((struct platform_device *)0)->id_auto
$4 = (bool *) 0xc
(gdb) p &((struct platform_device *)0)->dev
$5 = (struct device *) 0x10
Above output shows the offset of different variables in the structure.
No comments:
Post a Comment