| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com> |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or |
|---|
| 5 | | - * modify it under the terms of the GNU General Public License |
|---|
| 6 | | - * as published by the Free Software Foundation; either version 2 |
|---|
| 7 | | - * of the License, or (at your option) any later version. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License |
|---|
| 15 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 16 | 4 | */ |
|---|
| 17 | 5 | |
|---|
| 18 | 6 | #ifndef _WARN_H |
|---|
| .. | .. |
|---|
| 33 | 21 | char *name, *str; |
|---|
| 34 | 22 | unsigned long name_off; |
|---|
| 35 | 23 | |
|---|
| 36 | | - func = find_containing_func(sec, offset); |
|---|
| 24 | + func = find_func_containing(sec, offset); |
|---|
| 37 | 25 | if (func) { |
|---|
| 38 | 26 | name = func->name; |
|---|
| 39 | 27 | name_off = offset - func->offset; |
|---|
| .. | .. |
|---|
| 64 | 52 | free(_str); \ |
|---|
| 65 | 53 | }) |
|---|
| 66 | 54 | |
|---|
| 55 | +#define BT_FUNC(format, insn, ...) \ |
|---|
| 56 | +({ \ |
|---|
| 57 | + struct instruction *_insn = (insn); \ |
|---|
| 58 | + char *_str = offstr(_insn->sec, _insn->offset); \ |
|---|
| 59 | + WARN(" %s: " format, _str, ##__VA_ARGS__); \ |
|---|
| 60 | + free(_str); \ |
|---|
| 61 | +}) |
|---|
| 62 | + |
|---|
| 67 | 63 | #define WARN_ELF(format, ...) \ |
|---|
| 68 | 64 | WARN(format ": %s", ##__VA_ARGS__, elf_errmsg(-1)) |
|---|
| 69 | 65 | |
|---|