diff options
Diffstat (limited to 'gprofng/src/Symbol.h')
-rw-r--r-- | gprofng/src/Symbol.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/gprofng/src/Symbol.h b/gprofng/src/Symbol.h new file mode 100644 index 0000000..25cceca --- /dev/null +++ b/gprofng/src/Symbol.h @@ -0,0 +1,80 @@ +/* Copyright (C) 2025 Free Software Foundation, Inc. + Contributed by Oracle. + + This file is part of GNU Binutils. + + 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 3, 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +class Function; +class Module; + +class Range +{ +public: + Range (uint64_t _low, uint64_t _high) + { + low = _low; + high = _high; + } + + inline bool + inside (uint64_t val) + { + return val >= low && val < high; + }; + + uint64_t low; + uint64_t high; +}; + +class Symbol +{ +public: + Symbol (Vector<Symbol *> *vec = NULL); + ~Symbol (); + + Symbol * + cardinal () + { + return alias ? alias : this; + } + + // Find symbols in 'syms' matched by 'ranges'. + static Vector<Symbol *> *find_symbols (Vector<Symbol *> *syms, + Vector<Range *> *ranges); + static Vector<Symbol *> *sort_by_name (Vector<Symbol *> *syms); + + // Find symbol in CU corresponding to pc or linker_name. + static Symbol *get_symbol (Vector<Symbol *> *syms, uint64_t pc); + static Symbol *get_symbol (Vector<Symbol *> *syms, char *linker_name); + + // Create and append a new function to the 'module'. + // Copy attributes (size, name, etc) from Simbol, + Function *createFunction(Module *module); + void dump (const char *msg = NULL); + + Function *func; + Sp_lang_code lang_code; + uint64_t value; + uint64_t save; + int64_t size; + uint64_t img_offset; // image offset in the ELF file + char *name; + Symbol *alias; + int local_ind; + int flags; + bool defined; +};
\ No newline at end of file |