]>
Commit | Line | Data |
---|---|---|
9a5de187 MH |
1 | /* -*- linux-c -*- |
2 | * Copyright (C) 2005-2008 Red Hat Inc. | |
33f88a80 FCE |
3 | * |
4 | * This file is part of systemtap, and is free software. You can | |
5 | * redistribute it and/or modify it under the terms of the GNU General | |
6 | * Public License (GPL); either version 2, or (at your option) any | |
7 | * later version. | |
8 | */ | |
9 | ||
aaf2af3e FCE |
10 | #ifndef _STP_SYM_H_ |
11 | #define _STP_SYM_H_ | |
33f88a80 | 12 | |
f1bad60c | 13 | #define STP_MODULE_NAME_LEN 64 |
33f88a80 | 14 | |
f1bad60c | 15 | struct _stp_symbol { |
9a5de187 MH |
16 | unsigned long addr; |
17 | const char *symbol; | |
18 | }; | |
33f88a80 | 19 | |
9a5de187 MH |
20 | DEFINE_RWLOCK(_stp_module_lock); |
21 | #define STP_RLOCK_MODULES read_lock_irqsave(&_stp_module_lock, flags) | |
22 | #define STP_WLOCK_MODULES write_lock_irqsave(&_stp_module_lock, flags) | |
23 | #define STP_RUNLOCK_MODULES read_unlock_irqrestore(&_stp_module_lock, flags) | |
24 | #define STP_WUNLOCK_MODULES write_unlock_irqrestore(&_stp_module_lock, flags) | |
f1bad60c | 25 | |
9a5de187 MH |
26 | struct _stp_module { |
27 | /* the module name, or "" for kernel */ | |
28 | char name[STP_MODULE_NAME_LEN]; | |
29 | ||
30 | /* A pointer to the struct module. Note that we cannot */ | |
31 | /* trust this because as of 2.6.19, there are not yet */ | |
32 | /* any notifier hooks that will tell us when a module */ | |
33 | /* is unloading. */ | |
34 | unsigned long module; | |
35 | ||
36 | /* the start of the module's text and data sections */ | |
37 | unsigned long text; | |
38 | unsigned long data; | |
39 | ||
40 | uint32_t text_size; | |
41 | ||
42 | /* how many symbols this module has that we are interested in */ | |
43 | uint32_t num_symbols; | |
44 | ||
45 | /* how many sections this module has */ | |
46 | uint32_t num_sections; | |
47 | ||
aaf2af3e FCE |
48 | /* how the data below was allocated */ |
49 | /* 0 = kmalloc, 1 = vmalloc */ | |
50 | struct { | |
51 | unsigned symbols :1; | |
52 | unsigned symbol_data :1; | |
53 | unsigned unwind_data :1; | |
54 | unsigned unwind_hdr :1; | |
55 | } allocated; | |
9a5de187 MH |
56 | |
57 | struct _stp_symbol *sections; | |
58 | ||
59 | /* an array of num_symbols _stp_symbol structs */ | |
60 | struct _stp_symbol *symbols; /* ordered by address */ | |
61 | ||
62 | /* where we stash our copy of the strtab */ | |
63 | void *symbol_data; | |
64 | ||
65 | /* the stack unwind data for this module */ | |
66 | void *unwind_data; | |
aaf2af3e | 67 | void *unwind_hdr; |
9a5de187 | 68 | uint32_t unwind_data_len; |
aaf2af3e FCE |
69 | uint32_t unwind_hdr_len; |
70 | uint32_t unwind_is_ehframe; /* unwind data comes from .eh_frame */ | |
9a5de187 MH |
71 | rwlock_t lock; /* lock while unwinding is happening */ |
72 | ||
f1bad60c MH |
73 | }; |
74 | ||
75 | #ifndef STP_MAX_MODULES | |
49231d5e | 76 | #define STP_MAX_MODULES 256 |
f1bad60c MH |
77 | #endif |
78 | ||
79 | /* the alphabetical array of modules */ | |
80 | struct _stp_module *_stp_modules[STP_MAX_MODULES]; | |
81 | ||
82 | /* the array of modules ordered by addresses */ | |
83 | struct _stp_module *_stp_modules_by_addr[STP_MAX_MODULES]; | |
84 | ||
85 | /* the number of modules in the arrays */ | |
86 | int _stp_num_modules = 0; | |
87 | ||
c45f6fbf | 88 | unsigned long _stp_module_relocate (const char *module, const char *section, unsigned long offset); |
9a5de187 | 89 | static struct _stp_module *_stp_get_unwind_info (unsigned long addr); |
aaf2af3e | 90 | #endif /* _STP_SYM_H_ */ |