crash源码github可以下载
立即下载
资源介绍:
备份一下crash工具方便取
/* memory.c - core analysis suite
*
* Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
* Copyright (C) 2002-2019 David Anderson
* Copyright (C) 2002-2019 Red Hat, Inc. All rights reserved.
* Copyright (C) 2002 Silicon Graphics, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "defs.h"
#include
#include
#include
#include
#include "maple_tree.h"
struct meminfo { /* general purpose memory information structure */
ulong cache; /* used by the various memory searching/dumping */
ulong slab; /* routines. Only one of these is used per cmd */
ulong c_flags; /* so stuff whatever's helpful in here... */
ulong c_offset;
ulong c_num;
ulong s_mem;
void *s_freep;
ulong *s_index;
ulong s_inuse;
ulong cpucached_cache;
ulong cpucached_slab;
ulong inuse;
ulong order;
ulong slabsize;
ulong num_slabs;
ulong objects;
ulonglong spec_addr;
ulong flags;
ulong size;
ulong objsize;
int memtype;
int free;
int slab_offset;
char *reqname;
char *curname;
ulong *spec_cpumask;
ulong *addrlist;
int *kmem_bufctl;
ulong *cpudata[NR_CPUS];
ulong *shared_array_cache;
int current_cache_index;
ulong found;
ulong retval;
struct struct_member_data *page_member_cache;
ulong nr_members;
char *ignore;
int errors;
int calls;
int cpu;
int cache_count;
ulong get_shared;
ulong get_totalram;
ulong get_buffers;
ulong get_slabs;
char *slab_buf;
char *cache_buf;
ulong *cache_list;
struct vmlist {
ulong addr;
ulong size;
} *vmlist;
ulong container;
int *freelist;
int freelist_index_size;
ulong random;
ulong list_offset;
};
/*
* Search modes
*/
#define SEARCH_ULONG (0)
#define SEARCH_UINT (1)
#define SEARCH_USHORT (2)
#define SEARCH_CHARS (3)
#define SEARCH_DEFAULT (SEARCH_ULONG)
/* search mode information */
struct searchinfo {
int mode;
int vcnt;
int val;
int context;
int memtype;
int do_task_header;
int tasks_found;
struct task_context *task_context;
ulong vaddr_start;
ulong vaddr_end;
ulonglong paddr_start;
ulonglong paddr_end;
union {
/* default ulong search */
struct {
ulong value[MAXARGS];
char *opt_string[MAXARGS];
ulong mask;
} s_ulong;
/* uint search */
struct {
uint value[MAXARGS];
char *opt_string[MAXARGS];
uint mask;
} s_uint;
/* ushort search */
struct {
ushort value[MAXARGS];
char *opt_string[MAXARGS];
ushort mask;
} s_ushort;
/* string (chars) search */
struct {
char *value[MAXARGS];
int len[MAXARGS];
int started_flag; /* string search needs history */
} s_chars;
} s_parms;
char buf[BUFSIZE];
};
struct handle_each_vm_area_args {
ulong task;
ulong flag;
ulong vaddr;
struct reference *ref;
char *vma_header;
char *buf1;
char *buf2;
char *buf3;
char *buf4;
char *buf5;
ulong vma;
char **vma_buf;
struct task_mem_usage *tm;
int *found;
int *single_vma_found;
unsigned int radix;
struct task_context *tc;
ulong *single_vma;
};
static char *memtype_string(int, int);
static char *error_handle_string(ulong);
static void collect_page_member_data(char *, struct meminfo *);
struct integer_data {
ulong value;
ulong bitfield_value;
struct struct_member_data *pmd;
};
static int get_bitfield_data(struct integer_data *);
static int show_page_member_data(char *, ulong, struct meminfo *, char *);
static void dump_mem_map(struct meminfo *);
static void dump_mem_map_SPARSEMEM(struct meminfo *);
static void fill_mem_map_cache(ulong, ulong, char *);
static void page_flags_init(void);
static int page_flags_init_from_pageflag_names(void);
static int page_flags_init_from_pageflags_enum(void);
static int translate_page_flags(char *, ulong);
static void dump_free_pages(struct meminfo *);
static int dump_zone_page_usage(void);
static void dump_multidimensional_free_pages(struct meminfo *);
static void dump_free_pages_zones_v1(struct meminfo *);
static void dump_free_pages_zones_v2(struct meminfo *);
struct free_page_callback_data;
static int dump_zone_free_area(ulong, int, ulong, struct free_page_callback_data *);
static void dump_page_hash_table(struct meminfo *);
static void kmem_search(struct meminfo *);
static void kmem_cache_init(void);
static void kmem_cache_init_slub(void);
static ulong max_cpudata_limit(ulong, ulong *);
static int kmem_cache_downsize(void);
static int ignore_cache(struct meminfo *, char *);
static char *is_kmem_cache_addr(ulong, char *);
static char *is_kmem_cache_addr_common(ulong, char *);
static void kmem_cache_list(struct meminfo *);
static void dump_kmem_cache(struct meminfo *);
static void dump_kmem_cache_percpu_v1(struct meminfo *);
static void dump_kmem_cache_percpu_v2(struct meminfo *);
static void dump_kmem_cache_slub(struct meminfo *);
static void kmem_cache_list_common(struct meminfo *);
static ulong get_cpu_slab_ptr(struct meminfo *, int, ulong *);
static unsigned int oo_order(ulong);
static unsigned int oo_objects(ulong);
static char *vaddr_to_kmem_cache(ulong, char *, int);
static char *is_slab_overload_page(ulong, ulong *, char *);
static ulong vaddr_to_slab(ulong);
static void do_slab_chain(int, struct meminfo *);
static void do_slab_chain_percpu_v1(long, struct meminfo *);
static void do_slab_chain_percpu_v2(long, struct meminfo *);
static void do_slab_chain_percpu_v2_nodes(long, struct meminfo *);
static void do_slab_chain_slab_overload_page(long, struct meminfo *);
static int slab_freelist_index_size(void);
static int do_slab_slub(struct meminfo *, int);
static void do_kmem_cache_slub(struct meminfo *);
static void save_slab_data(struct meminfo *);
static int slab_data_saved(struct meminfo *);
static void dump_saved_slab_data(void);
static void dump_slab(struct meminfo *);
static void dump_slab_percpu_v1(struct meminfo *);
static void dump_slab_percpu_v2(struct meminfo *);
static void dump_slab_overload_page(struct meminfo *);
static int verify_slab_v1(struct meminfo *, ulong, int);
static int verify_slab_v2(struct meminfo *, ulong, int);
static int verify_slab_overload_page(struct meminfo *, ulong, int);
static void gather_slab_free_list(struct meminfo *);
static void gather_slab_free_list_percpu(struct meminfo *);
static void gather_slab_free_list_slab_overload_page(struct meminfo *);
static void gather_cpudata_list_v1(struct meminfo *);
static void gather_cpudata_list_v2(struct meminfo *);
static void gather_cpudata_list_v2_nodes(struct meminfo *, int);
static int check_cpudata_list(struct meminfo *, ulong);
static int check_shared_list(struct meminfo *, ulong);
static void gather_slab_cached_count(struct meminfo *);
static void dump_slab_objects(struct meminfo *);
static void dump_slab_objects_percpu(struct meminfo *);
static void dump_vmlist(struct meminfo *);
static void dump_vmap_area(struct meminfo *);
static int dump_page_lists(struct meminfo *);
static void dump_kmeminfo(void);
static int page_to_phys(ulong, physaddr_t *);
static void display_memory(ulonglong, long, ulong, int, void *);
static char *show_opt_string(struct searchinfo *);
static void display_with_pre_and_post(void *, ulonglong, struct searchinfo *);
static ulong search_ulong(ulong *, ulong, int, struct searchinfo *);
static ulong search_uint(ulong *, ulong, int, struct searchinfo *);
static ulong search_ushort(ulong *, ulong, int, struct searchinfo *);
static ulong search_chars(ulong *, ulong, int, struct searchinfo *);
static ulonglong search_ulong_p(ulong *, ulonglong, int, struct searchinfo *);
stat
资源文件列表:
crash-8.0.5.zip 大约有119个文件