Move the class and class_member structs to a new header file,
classes.h. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
parent
5c3d14ac09
commit
3593eb45a6
|
@ -0,0 +1,44 @@
|
||||||
|
#ifndef _PAHOLE_CLASSES_H_
|
||||||
|
#define _PAHOLE_CLASSES_H_ 1
|
||||||
|
/*
|
||||||
|
Copyright (C) 2006 Mandriva Conectiva S.A.
|
||||||
|
Copyright (C) 2006 Arnaldo Carvalho de Melo <acme@mandriva.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of version 2 of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
|
struct cu_info {
|
||||||
|
unsigned int cu;
|
||||||
|
uintmax_t offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct class {
|
||||||
|
struct list_head node;
|
||||||
|
struct list_head members;
|
||||||
|
char name[32];
|
||||||
|
unsigned long size;
|
||||||
|
struct cu_info id;
|
||||||
|
struct cu_info type;
|
||||||
|
unsigned int tag; /* struct, union, base type, etc */
|
||||||
|
uintmax_t nr_entries; /* For arrays */
|
||||||
|
const char *decl_file;
|
||||||
|
unsigned int decl_line;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct class_member {
|
||||||
|
struct list_head node;
|
||||||
|
char name[32];
|
||||||
|
struct cu_info type;
|
||||||
|
unsigned int offset;
|
||||||
|
unsigned int bit_size;
|
||||||
|
unsigned int bit_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _PAHOLE_CLASSES_H_ */
|
30
pahole.c
30
pahole.c
|
@ -7,10 +7,8 @@
|
||||||
published by the Free Software Foundation.
|
published by the Free Software Foundation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <dwarf.h>
|
#include <dwarf.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <libdw.h>
|
#include <libdw.h>
|
||||||
#include <libelf.h>
|
#include <libelf.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -19,6 +17,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
#include "classes.h"
|
||||||
|
|
||||||
static char bf[4096];
|
static char bf[4096];
|
||||||
|
|
||||||
|
@ -32,24 +31,6 @@ static void *zalloc(const size_t size)
|
||||||
|
|
||||||
static LIST_HEAD(classes);
|
static LIST_HEAD(classes);
|
||||||
|
|
||||||
struct cu_info {
|
|
||||||
unsigned int cu;
|
|
||||||
uintmax_t offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct class {
|
|
||||||
struct list_head node;
|
|
||||||
struct list_head members;
|
|
||||||
char name[32];
|
|
||||||
unsigned long size;
|
|
||||||
struct cu_info id;
|
|
||||||
struct cu_info type;
|
|
||||||
unsigned int tag; /* struct, union, base type, etc */
|
|
||||||
uintmax_t nr_entries; /* For arrays */
|
|
||||||
const char *decl_file;
|
|
||||||
unsigned int decl_line;
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *tag_name(const unsigned int tag)
|
const char *tag_name(const unsigned int tag)
|
||||||
{
|
{
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
|
@ -141,15 +122,6 @@ const char *class__name(struct class *self, char *bf, size_t len)
|
||||||
return bf;
|
return bf;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct class_member {
|
|
||||||
struct list_head node;
|
|
||||||
char name[32];
|
|
||||||
struct cu_info type;
|
|
||||||
unsigned int offset;
|
|
||||||
unsigned int bit_size;
|
|
||||||
unsigned int bit_offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct class_member *class_member__new(unsigned int cu,
|
struct class_member *class_member__new(unsigned int cu,
|
||||||
uintmax_t type,
|
uintmax_t type,
|
||||||
const char *name,
|
const char *name,
|
||||||
|
|
Loading…
Reference in New Issue