]> sourceware.org Git - systemtap.git/blame - runtime/sym.h
update copyrights
[systemtap.git] / runtime / sym.h
CommitLineData
9a5de187 1/* -*- linux-c -*-
ef36f781 2 * Copyright (C) 2005-2014 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
eb55594d
MW
13/* Constants for printing address symbols. */
14
15/* Prints address as hex, plus space, no newline. */
16#define _STP_SYM_HEXSTR 0
17/* Prints symbol when found for address otherwise hex. */
18#define _STP_SYM_SYMBOL 1
19/* Prints "hex : symbol" when used in combination with _STP_SYM_SYMBOL
20 if symbol found for address otherwise hex only. */
21#define _STP_SYM_HEX_SYMBOL 2
22/* Adds module " [name]" if found. */
23#define _STP_SYM_MODULE 4
24/* Adds offset to symbol and/or module when used. */
25#define _STP_SYM_OFFSET 8
26/* Adds size to offset of symbol or module, when _STP_SYM_OFFSET used. */
27#define _STP_SYM_SIZE 16
28/* Adds the string " (inexact)", if used in together with _STP_SYM_SYMBOL. */
29#define _STP_SYM_INEXACT 32
30/* Prefixes a space character. */
31#define _STP_SYM_PRE_SPACE 64
32/* Postfixes a space character, takes precedence over _STP_SYM_NEWLINE. */
33#define _STP_SYM_POST_SPACE 128
34/* Adds a newline character, doesn't combine with _STP_SYM_POST_SPACE. */
35#define _STP_SYM_NEWLINE 256
35f71b69
FCE
36/* Adds only module " [`basename name`]" if found, use with _STP_SYM_MODULE. */
37#define _STP_SYM_MODULE_BASENAME 512
eb55594d
MW
38
39/* Used for backtraces in hex string form. */
40#define _STP_SYM_NONE (_STP_SYM_HEXSTR | _STP_SYM_POST_SPACE)
41/* Special "brief" case, used by print_ubacktrace_brief, no hex if possible. */
42#define _STP_SYM_BRIEF (_STP_SYM_SYMBOL | _STP_SYM_OFFSET | _STP_SYM_NEWLINE)
098024de 43/* Full symbol format, as used in printed backtraces. */
eb55594d
MW
44#define _STP_SYM_FULL (_STP_SYM_SYMBOL | _STP_SYM_HEX_SYMBOL \
45 | _STP_SYM_MODULE | _STP_SYM_OFFSET \
46 | _STP_SYM_SIZE | _STP_SYM_PRE_SPACE \
47 | _STP_SYM_NEWLINE)
098024de 48/* Simple symbol format, as used in backtraces for strings. */
35f71b69 49#define _STP_SYM_SIMPLE (_STP_SYM_SYMBOL | _STP_SYM_MODULE | _STP_SYM_MODULE_BASENAME \
098024de 50 | _STP_SYM_OFFSET | _STP_SYM_NEWLINE)
26bb6698
MW
51/* All symbol information (as used by [u]symdata). */
52#define _STP_SYM_DATA (_STP_SYM_SYMBOL | _STP_SYM_MODULE \
53 | _STP_SYM_OFFSET | _STP_SYM_SIZE)
eb55594d 54
f1bad60c 55struct _stp_symbol {
9a5de187
MH
56 unsigned long addr;
57 const char *symbol;
58};
33f88a80 59
7795c7e7
FCE
60struct _stp_section {
61 const char *name;
2d0ddea1 62 unsigned long static_addr; /* XXX non-null if everywhere the same. */
60ad8eba 63 unsigned long size; /* length of the address space module covers. */
7795c7e7
FCE
64 struct _stp_symbol *symbols; /* ordered by address */
65 unsigned num_symbols;
7795c7e7 66
4d83bd9b
MW
67 /* Synthesized index for .debug_frame table, keep section
68 offset to adjust addresses relative to load address. */
69 void *debug_hdr;
70 uint32_t debug_hdr_len;
71 unsigned long sec_load_offset;
72};
7795c7e7 73
9a5de187 74struct _stp_module {
496fec26
FCE
75 const char* name; /* module name (kernel) or /canonical/path for userspace*/
76 const char* path; /* canonical filesystem path (kernel .ko or user) */
7795c7e7
FCE
77 struct _stp_section *sections;
78 unsigned num_sections;
79
4d83bd9b
MW
80 /* The .eh_frame unwind data for this module.
81 Note index for .debug_frame (hdr) is per section. */
4285dc9a
MW
82 void *debug_frame;
83 void *eh_frame;
aaf2af3e 84 void *unwind_hdr;
4285dc9a
MW
85 uint32_t debug_frame_len;
86 uint32_t eh_frame_len;
aaf2af3e 87 uint32_t unwind_hdr_len;
4285dc9a 88 unsigned long eh_frame_addr; /* Orig load address (offset) .eh_frame */
0f33053e 89 unsigned long unwind_hdr_addr; /* same for .eh_frame_hdr */
4d83bd9b 90
29495972
WH
91 /* build-id information */
92 unsigned char *build_id_bits;
93 unsigned long build_id_offset;
0d633db2 94 unsigned long notes_sect;
29495972 95 int build_id_len;
f1bad60c
MH
96};
97
1b94bf6d 98/* Defined by translator-generated stap-symbols.h. */
4c2732a1 99static struct _stp_module *_stp_modules [];
89815df7 100static const unsigned _stp_num_modules;
1b94bf6d 101
129de9ef
MW
102/* Used in the unwinder to special case unwinding through kretprobes. */
103/* Initialized through translator (stap-symbols.h) relative to kernel */
104/* load address, fixup by transport symbols _stp_do_relocation */
105static unsigned long _stp_kretprobe_trampoline;
f1bad60c 106
a049e342
MW
107static unsigned long _stp_kmodule_relocate (const char *module,
108 const char *section,
109 unsigned long offset);
110static unsigned long _stp_umodule_relocate (const char *module,
111 unsigned long offset,
112 struct task_struct *tsk);
9a5de187 113static struct _stp_module *_stp_get_unwind_info (unsigned long addr);
057ff477
FCE
114static void _stp_kmodule_update_address(const char* module,
115 const char* section,
116 unsigned long offset);
7795c7e7 117
3222365c
LB
118#if defined(STP_USE_DWARF_UNWINDER) && defined(STP_NEED_UNWIND_DATA)
119static struct _stp_module _stp_module_self;
120static struct _stp_section _stp_module_self_sections[];
121static struct _stp_symbol _stp_module_self_symbols_0[];
122static struct _stp_symbol _stp_module_self_symbols_1[];
123#endif /* defined(STP_USE_DWARF_UNWINDER) && defined(STP_NEED_UNWIND_DATA) */
aaf2af3e 124#endif /* _STP_SYM_H_ */
This page took 0.162087 seconds and 5 git commands to generate.