| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $ */ | | 1 | /* $NetBSD: db_disasm.c,v 1.42 2021/04/12 11:35:22 simonb Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1991, 1993 | | 4 | * Copyright (c) 1991, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Ralph Campbell. | | 8 | * Ralph Campbell. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | * | | 33 | * |
34 | * from: @(#)kadb.c 8.1 (Berkeley) 6/10/93 | | 34 | * from: @(#)kadb.c 8.1 (Berkeley) 6/10/93 |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.42 2021/04/12 11:35:22 simonb Exp $"); |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/cpu.h> | | 41 | #include <sys/cpu.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | | | 43 | |
44 | #include <mips/locore.h> | | 44 | #include <mips/locore.h> |
45 | #include <mips/mips_opcode.h> | | 45 | #include <mips/mips_opcode.h> |
46 | #include <mips/reg.h> | | 46 | #include <mips/reg.h> |
47 | | | 47 | |
48 | #include <machine/db_machdep.h> | | 48 | #include <machine/db_machdep.h> |
49 | | | 49 | |
50 | #include <ddb/db_user.h> | | 50 | #include <ddb/db_user.h> |
51 | #include <ddb/db_interface.h> | | 51 | #include <ddb/db_interface.h> |
| @@ -900,23 +900,21 @@ db_disasm_insn(int insn, db_addr_t loc, | | | @@ -900,23 +900,21 @@ db_disasm_insn(int insn, db_addr_t loc, |
900 | | | 900 | |
901 | static void | | 901 | static void |
902 | print_addr(db_addr_t loc) | | 902 | print_addr(db_addr_t loc) |
903 | { | | 903 | { |
904 | db_expr_t diff; | | 904 | db_expr_t diff; |
905 | db_sym_t sym; | | 905 | db_sym_t sym; |
906 | const char *symname; | | 906 | const char *symname; |
907 | | | 907 | |
908 | diff = INT_MAX; | | 908 | diff = INT_MAX; |
909 | symname = NULL; | | 909 | symname = NULL; |
910 | sym = db_search_symbol(loc, DB_STGY_ANY, &diff); | | 910 | sym = db_search_symbol(loc, DB_STGY_ANY, &diff); |
911 | db_symbol_values(sym, &symname, 0); | | 911 | db_symbol_values(sym, &symname, 0); |
912 | | | 912 | |
| | | 913 | db_printf("%#"PRIxVADDR, loc); |
913 | if (symname) { | | 914 | if (symname) { |
914 | if (diff == 0) | | 915 | db_printf(" <%s", symname); |
915 | db_printf("%s", symname); | | 916 | if (diff != 0) |
916 | else | | 917 | db_printf("+%#"DDB_EXPR_FMT"x", diff); |
917 | db_printf("<%s+%#"DDB_EXPR_FMT"x>", symname, diff); | | 918 | db_printf(">"); |
918 | db_printf("\t[addr:%#"PRIxVADDR"]", loc); | | | |
919 | } else { | | | |
920 | db_printf("%#"PRIxVADDR, loc); | | | |
921 | } | | 919 | } |
922 | } | | 920 | } |